@kayjs/kay 1.105.0 → 1.107.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/README.md +2 -2
- package/dist/eslint.js +777 -210
- package/editors/zed/extension.toml +2 -2
- package/llms/action-protection.md +2 -2
- package/llms/actions-from-islands.md +2 -2
- package/llms/actions-refused-fields.md +22 -0
- package/llms/actions.md +24 -41
- package/llms/analytics.md +1 -1
- package/llms/api-from-islands.md +1 -1
- package/llms/api-routes.md +6 -6
- package/llms/browser-only.md +1 -1
- package/llms/check-and-tools.md +1 -1
- package/llms/code-lints.md +2 -2
- package/llms/compiler-api.md +1 -1
- package/llms/component-libraries.md +1 -0
- package/llms/components.md +1 -1
- package/llms/content-cms.md +1 -1
- package/llms/content-markdown-to-caching.md +1 -1
- package/llms/content-preview.md +2 -2
- package/llms/content.md +21 -21
- package/llms/deprecated-lints-1-105-libraries.md +2 -0
- package/llms/deprecated-lints-1-105.md +3 -3
- package/llms/deprecated-lints.md +4 -4
- package/llms/dev-tool.md +2 -2
- package/llms/environment.md +22 -22
- package/llms/files.md +5 -5
- package/llms/island-and-form-lints.md +1 -0
- package/llms/islands-state-to-ids.md +2 -1
- package/llms/islands.md +10 -1
- package/llms/local-collections.md +2 -2
- package/llms/mcp.md +2 -1
- package/llms/navigation-from-code.md +1 -1
- package/llms/notifications.md +4 -2
- package/llms/project-new-and-add.md +1 -1
- package/llms/project.md +3 -3
- package/llms/rate-limits.md +1 -1
- package/llms/recipes.md +16 -16
- package/llms/rooms.md +4 -4
- package/llms/routing-endpoints-and-base.md +1 -1
- package/llms/routing.md +5 -5
- package/llms/schemas.md +14 -7
- package/llms/server.md +7 -7
- package/llms/site.md +9 -9
- package/llms/sitemap-search-fonts.md +2 -0
- package/llms/styles-and-assets.md +2 -1
- package/llms/templates-elements-slots-snippets.md +2 -2
- package/llms/testing-browser.md +20 -0
- package/llms/testing.md +1 -1
- package/llms/upgrading-1-105-config.md +2 -2
- package/llms/upgrading.md +37 -4
- package/llms/whats-new-archive.md +35 -66
- package/llms/whats-new.md +47 -28
- package/llms.txt +1 -1
- package/package.json +24 -11
- package/src/add.ts +1 -1
- package/src/build/class-table.ts +2 -2
- package/src/build/client.ts +27 -30
- package/src/build/entry-files.ts +19 -0
- package/src/build/lazy-components.ts +130 -0
- package/src/build/lazy-manifest.ts +56 -0
- package/src/build/lazy-stubs.ts +31 -0
- package/src/build/plugin.ts +16 -11
- package/src/build/runtime-chunk.ts +1 -1
- package/src/build/styles.ts +3 -3
- package/src/build/transform.ts +19 -7
- package/src/build/ui-layers.ts +30 -0
- package/src/build/ui.ts +108 -11
- package/src/build/variants.ts +125 -46
- package/src/build/worker-bundle.ts +6 -0
- package/src/check/action-options.ts +56 -0
- package/src/check/boot.ts +22 -1
- package/src/check/call-result.ts +242 -0
- package/src/check/config-objects.ts +17 -2
- package/src/check/diagnose.ts +22 -0
- package/src/check/handler-events.ts +149 -0
- package/src/check/index.ts +6 -2
- package/src/check/link-flag-tests.ts +130 -0
- package/src/check/project.ts +4 -3
- package/src/check/refusal-calls.ts +2 -2
- package/src/check/regroup.ts +5 -3
- package/src/check/renamed-packages.ts +58 -14
- package/src/check/schema-builders.ts +256 -0
- package/src/check/schema-json.ts +226 -0
- package/src/check/secret-keys.ts +15 -2
- package/src/check/shadow-types.ts +13 -9
- package/src/check/template-hints.ts +1 -1
- package/src/check/tool-labels.ts +11 -9
- package/src/check/ui-types.ts +4 -3
- package/src/check/ui.ts +14 -11
- package/src/commands/env-declare.ts +18 -6
- package/src/commands/routes.ts +1 -1
- package/src/compiler/a11y.ts +8 -1
- package/src/compiler/ast.ts +1 -1
- package/src/compiler/bound-props.ts +1 -1
- package/src/compiler/codegen.ts +13 -23
- package/src/compiler/deprecated-lints-1-105.ts +41 -0
- package/src/compiler/deprecated-lints-1-106.ts +14 -0
- package/src/compiler/deprecated-lints-1-107.ts +14 -0
- package/src/compiler/deprecated-lints.ts +17 -60
- package/src/compiler/deprecated-typed-lints.ts +23 -0
- package/src/compiler/dom-here.ts +72 -0
- package/src/compiler/dom.ts +23 -23
- package/src/compiler/fence-checks.ts +12 -11
- package/src/compiler/field-described.ts +2 -2
- package/src/compiler/helper-imports.ts +1 -1
- package/src/compiler/html-fields.ts +92 -0
- package/src/compiler/html-initial.ts +5 -3
- package/src/compiler/html.ts +14 -31
- package/src/compiler/import-edits.ts +15 -0
- package/src/compiler/index.ts +10 -3
- package/src/compiler/island-declaration.ts +15 -0
- package/src/compiler/items.ts +5 -5
- package/src/compiler/kay-exports.ts +1 -0
- package/src/compiler/lazy-imports.ts +357 -0
- package/src/compiler/link-flags.ts +6 -5
- package/src/compiler/lints.ts +12 -12
- package/src/compiler/parser.ts +2 -2
- package/src/compiler/rest-omits.ts +15 -0
- package/src/compiler/route-lints.ts +2 -0
- package/src/compiler/schema-lints.ts +13 -0
- package/src/compiler/script-server.ts +6 -3
- package/src/config-loader.ts +10 -2
- package/src/config-resolve.ts +3 -1
- package/src/config-shape.ts +2 -2
- package/src/config.ts +20 -4
- package/src/content/markdown.ts +2 -3
- package/src/content/validate.ts +1 -1
- package/src/generate-resource.ts +9 -9
- package/src/generate.ts +1 -1
- package/src/mcp/guards.ts +1 -1
- package/src/mcp/tools.ts +1 -1
- package/src/migrate/content.ts +61 -55
- package/src/new.ts +6 -2
- package/src/runtime/action-shared.ts +2 -2
- package/src/runtime/action.ts +51 -4
- package/src/runtime/client.ts +10 -0
- package/src/runtime/dom-lazy.ts +276 -0
- package/src/runtime/field-errors.ts +58 -0
- package/src/runtime/field-refusal.ts +179 -0
- package/src/runtime/form-types.ts +99 -0
- package/src/runtime/form.ts +25 -9
- package/src/runtime/html.ts +42 -6
- package/src/runtime/index.ts +2 -0
- package/src/runtime/island.server.ts +36 -2
- package/src/runtime/markdown-autolink.ts +69 -0
- package/src/runtime/markdown-render.client.ts +39 -3
- package/src/runtime/markdown.client.ts +6 -3
- package/src/runtime/markdown.server.ts +6 -3
- package/src/runtime/markdown.ts +125 -1
- package/src/runtime/navigate-api.ts +10 -5
- package/src/runtime/persist.ts +7 -7
- package/src/runtime/query-param.ts +1 -1
- package/src/runtime/reactive.ts +14 -0
- package/src/runtime/sanitize.ts +3 -1
- package/src/runtime/schema-record.ts +32 -0
- package/src/runtime/schema.client.ts +101 -14
- package/src/runtime/schema.ts +328 -26
- package/src/runtime/standard-schema.ts +32 -0
- package/src/runtime/swap-focus.ts +59 -11
- package/src/runtime/validate-run.client.ts +179 -0
- package/src/runtime/validate.client.ts +11 -0
- package/src/runtime/validate.ts +4 -137
- package/src/server/action-module.ts +16 -0
- package/src/server/actions.ts +54 -57
- package/src/server/answer.ts +102 -0
- package/src/server/api-input.ts +166 -0
- package/src/server/api-modules.ts +1 -1
- package/src/server/api.ts +12 -32
- package/src/server/app-stages.ts +38 -26
- package/src/server/app.ts +5 -2
- package/src/server/client.ts +2 -0
- package/src/server/dev-ui.ts +2 -2
- package/src/server/dev.ts +7 -9
- package/src/server/env-state.ts +1 -1
- package/src/server/env.ts +11 -3
- package/src/server/favicon.ts +47 -1
- package/src/server/file-limit.ts +7 -1
- package/src/server/forms.ts +1 -1
- package/src/server/host-allowlist.ts +7 -7
- package/src/server/image-metadata-bmff.ts +1 -1
- package/src/server/index.ts +2 -0
- package/src/server/kay-routes.ts +221 -0
- package/src/server/kay-server.ts +228 -0
- package/src/server/kept-exports.ts +1 -0
- package/src/server/kept-pages.ts +3 -3
- package/src/server/library.ts +2 -2
- package/src/server/mcp.ts +14 -13
- package/src/server/notifications.ts +4 -2
- package/src/server/offline.ts +24 -7
- package/src/server/openapi.ts +12 -3
- package/src/server/phases.ts +249 -0
- package/src/server/protection.ts +6 -6
- package/src/server/proxy-key.ts +8 -8
- package/src/server/push-settings.ts +16 -2
- package/src/server/push.ts +12 -4
- package/src/server/query.ts +17 -31
- package/src/server/receive.ts +43 -0
- package/src/server/render-document.ts +13 -3
- package/src/server/render.ts +1 -1
- package/src/server/request-context.ts +137 -0
- package/src/server/schema-check.ts +1 -1
- package/src/server/scope.ts +20 -13
- package/src/server/signals.ts +4 -4
- package/src/server/socket.ts +19 -47
- package/src/server/stream.ts +1 -1
- package/src/server/validate.ts +346 -0
- package/src/template-ws.ts +1 -1
- package/src/test/a11y-dom.ts +70 -0
- package/src/test/html-snapshot.ts +103 -0
- package/src/test/index.ts +2 -1
- package/src/test/mount.ts +14 -3
- package/src/test/page-checks.ts +12 -0
- package/src/test/screenshot-match.ts +2 -2
- package/src/test/shared-modules.ts +27 -5
- package/src/test/site-types.ts +5 -1
- package/types/build/class-table.d.ts +1 -1
- package/types/build/class-table.d.ts.map +1 -1
- package/types/build/client.d.ts +3 -2
- package/types/build/client.d.ts.map +1 -1
- package/types/build/entry-files.d.ts +4 -0
- package/types/build/entry-files.d.ts.map +1 -0
- package/types/build/lazy-components.d.ts +6 -0
- package/types/build/lazy-components.d.ts.map +1 -0
- package/types/build/lazy-manifest.d.ts +19 -0
- package/types/build/lazy-manifest.d.ts.map +1 -0
- package/types/build/lazy-stubs.d.ts +5 -0
- package/types/build/lazy-stubs.d.ts.map +1 -0
- package/types/build/plugin.d.ts +1 -0
- package/types/build/plugin.d.ts.map +1 -1
- package/types/build/transform.d.ts +4 -1
- package/types/build/transform.d.ts.map +1 -1
- package/types/build/ui-layers.d.ts +5 -0
- package/types/build/ui-layers.d.ts.map +1 -0
- package/types/build/ui.d.ts +7 -0
- package/types/build/ui.d.ts.map +1 -1
- package/types/build/variants.d.ts +1 -1
- package/types/build/variants.d.ts.map +1 -1
- package/types/build/worker-bundle.d.ts +1 -0
- package/types/build/worker-bundle.d.ts.map +1 -1
- package/types/check/action-options.d.ts +3 -0
- package/types/check/action-options.d.ts.map +1 -0
- package/types/check/boot.d.ts.map +1 -1
- package/types/check/call-result.d.ts +7 -0
- package/types/check/call-result.d.ts.map +1 -0
- package/types/check/config-objects.d.ts.map +1 -1
- package/types/check/diagnose.d.ts.map +1 -1
- package/types/check/handler-events.d.ts +9 -0
- package/types/check/handler-events.d.ts.map +1 -0
- package/types/check/index.d.ts +1 -0
- package/types/check/index.d.ts.map +1 -1
- package/types/check/link-flag-tests.d.ts +4 -0
- package/types/check/link-flag-tests.d.ts.map +1 -0
- package/types/check/project.d.ts.map +1 -1
- package/types/check/regroup.d.ts +1 -1
- package/types/check/regroup.d.ts.map +1 -1
- package/types/check/renamed-packages.d.ts +1 -0
- package/types/check/renamed-packages.d.ts.map +1 -1
- package/types/check/schema-builders.d.ts +3 -0
- package/types/check/schema-builders.d.ts.map +1 -0
- package/types/check/schema-json.d.ts +3 -0
- package/types/check/schema-json.d.ts.map +1 -0
- package/types/check/secret-keys.d.ts.map +1 -1
- package/types/check/shadow-types.d.ts.map +1 -1
- package/types/check/template-hints.d.ts +1 -0
- package/types/check/template-hints.d.ts.map +1 -1
- package/types/check/tool-labels.d.ts.map +1 -1
- package/types/check/ui-types.d.ts.map +1 -1
- package/types/check/ui.d.ts.map +1 -1
- package/types/commands/env-declare.d.ts.map +1 -1
- package/types/compiler/a11y.d.ts.map +1 -1
- package/types/compiler/bound-props.d.ts +1 -0
- package/types/compiler/bound-props.d.ts.map +1 -1
- package/types/compiler/codegen.d.ts +3 -0
- package/types/compiler/codegen.d.ts.map +1 -1
- package/types/compiler/deprecated-lints-1-105.d.ts +39 -0
- package/types/compiler/deprecated-lints-1-105.d.ts.map +1 -0
- package/types/compiler/deprecated-lints-1-106.d.ts +12 -0
- package/types/compiler/deprecated-lints-1-106.d.ts.map +1 -0
- package/types/compiler/deprecated-lints-1-107.d.ts +12 -0
- package/types/compiler/deprecated-lints-1-107.d.ts.map +1 -0
- package/types/compiler/deprecated-lints.d.ts +41 -22
- package/types/compiler/deprecated-lints.d.ts.map +1 -1
- package/types/compiler/deprecated-typed-lints.d.ts +21 -0
- package/types/compiler/deprecated-typed-lints.d.ts.map +1 -0
- package/types/compiler/dom-here.d.ts +14 -0
- package/types/compiler/dom-here.d.ts.map +1 -0
- package/types/compiler/dom.d.ts +1 -0
- package/types/compiler/dom.d.ts.map +1 -1
- package/types/compiler/fence-checks.d.ts.map +1 -1
- package/types/compiler/field-described.d.ts +1 -1
- package/types/compiler/field-described.d.ts.map +1 -1
- package/types/compiler/html-fields.d.ts +19 -0
- package/types/compiler/html-fields.d.ts.map +1 -0
- package/types/compiler/html-initial.d.ts +3 -2
- package/types/compiler/html-initial.d.ts.map +1 -1
- package/types/compiler/html.d.ts.map +1 -1
- package/types/compiler/import-edits.d.ts +1 -0
- package/types/compiler/import-edits.d.ts.map +1 -1
- package/types/compiler/index.d.ts +3 -0
- package/types/compiler/index.d.ts.map +1 -1
- package/types/compiler/island-declaration.d.ts +5 -0
- package/types/compiler/island-declaration.d.ts.map +1 -1
- package/types/compiler/items.d.ts +4 -1
- package/types/compiler/items.d.ts.map +1 -1
- package/types/compiler/kay-exports.d.ts.map +1 -1
- package/types/compiler/lazy-imports.d.ts +33 -0
- package/types/compiler/lazy-imports.d.ts.map +1 -0
- package/types/compiler/link-flags.d.ts +6 -0
- package/types/compiler/link-flags.d.ts.map +1 -1
- package/types/compiler/lints.d.ts +61 -34
- package/types/compiler/lints.d.ts.map +1 -1
- package/types/compiler/rest-omits.d.ts +4 -0
- package/types/compiler/rest-omits.d.ts.map +1 -0
- package/types/compiler/route-lints.d.ts +8 -0
- package/types/compiler/route-lints.d.ts.map +1 -1
- package/types/compiler/schema-lints.d.ts +11 -0
- package/types/compiler/schema-lints.d.ts.map +1 -0
- package/types/compiler/script-server.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.d.ts +15 -2
- package/types/config.d.ts.map +1 -1
- package/types/content/markdown.d.ts.map +1 -1
- package/types/migrate/content.d.ts.map +1 -1
- package/types/new.d.ts +1 -0
- package/types/new.d.ts.map +1 -1
- package/types/runtime/action-shared.d.ts +1 -1
- package/types/runtime/action-shared.d.ts.map +1 -1
- package/types/runtime/action.d.ts +29 -1
- package/types/runtime/action.d.ts.map +1 -1
- package/types/runtime/client.d.ts.map +1 -1
- package/types/runtime/dom-lazy.d.ts +6 -0
- package/types/runtime/dom-lazy.d.ts.map +1 -0
- package/types/runtime/field-errors.d.ts +4 -0
- package/types/runtime/field-errors.d.ts.map +1 -0
- package/types/runtime/field-refusal.d.ts +37 -0
- package/types/runtime/field-refusal.d.ts.map +1 -0
- package/types/runtime/form-types.d.ts +6 -0
- package/types/runtime/form-types.d.ts.map +1 -0
- package/types/runtime/form.d.ts +4 -2
- package/types/runtime/form.d.ts.map +1 -1
- package/types/runtime/html.d.ts +3 -0
- package/types/runtime/html.d.ts.map +1 -1
- package/types/runtime/index.d.ts +2 -0
- 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/markdown-autolink.d.ts +11 -0
- package/types/runtime/markdown-autolink.d.ts.map +1 -0
- package/types/runtime/markdown-render.client.d.ts +2 -1
- package/types/runtime/markdown-render.client.d.ts.map +1 -1
- package/types/runtime/markdown.client.d.ts +3 -1
- package/types/runtime/markdown.client.d.ts.map +1 -1
- package/types/runtime/markdown.d.ts +11 -0
- package/types/runtime/markdown.d.ts.map +1 -1
- package/types/runtime/markdown.server.d.ts +3 -1
- package/types/runtime/markdown.server.d.ts.map +1 -1
- package/types/runtime/navigate-api.d.ts +1 -1
- package/types/runtime/navigate-api.d.ts.map +1 -1
- package/types/runtime/persist.d.ts +2 -2
- package/types/runtime/persist.d.ts.map +1 -1
- package/types/runtime/reactive.d.ts +3 -0
- package/types/runtime/reactive.d.ts.map +1 -1
- package/types/runtime/sanitize.d.ts.map +1 -1
- package/types/runtime/schema-record.d.ts +9 -0
- package/types/runtime/schema-record.d.ts.map +1 -0
- package/types/runtime/schema.client.d.ts.map +1 -1
- package/types/runtime/schema.d.ts +99 -10
- package/types/runtime/schema.d.ts.map +1 -1
- package/types/runtime/standard-schema.d.ts +37 -0
- package/types/runtime/standard-schema.d.ts.map +1 -0
- package/types/runtime/swap-focus.d.ts.map +1 -1
- package/types/runtime/validate-run.client.d.ts +4 -0
- package/types/runtime/validate-run.client.d.ts.map +1 -0
- package/types/runtime/validate.client.d.ts +4 -0
- package/types/runtime/validate.client.d.ts.map +1 -0
- package/types/runtime/validate.d.ts +1 -21
- package/types/runtime/validate.d.ts.map +1 -1
- package/types/server/action-module.d.ts +2 -0
- package/types/server/action-module.d.ts.map +1 -0
- package/types/server/actions.d.ts +1 -0
- package/types/server/actions.d.ts.map +1 -1
- package/types/server/answer.d.ts +6 -0
- package/types/server/answer.d.ts.map +1 -0
- package/types/server/api-input.d.ts +19 -0
- package/types/server/api-input.d.ts.map +1 -0
- package/types/server/api.d.ts.map +1 -1
- package/types/server/app-stages.d.ts +7 -3
- package/types/server/app-stages.d.ts.map +1 -1
- package/types/server/app.d.ts +2 -0
- package/types/server/app.d.ts.map +1 -1
- package/types/server/client.d.ts +1 -0
- package/types/server/client.d.ts.map +1 -1
- package/types/server/dev.d.ts +1 -1
- package/types/server/dev.d.ts.map +1 -1
- package/types/server/env-state.d.ts.map +1 -1
- package/types/server/env.d.ts +5 -1
- package/types/server/env.d.ts.map +1 -1
- package/types/server/favicon.d.ts +3 -1
- package/types/server/favicon.d.ts.map +1 -1
- package/types/server/file-limit.d.ts.map +1 -1
- package/types/server/host-allowlist.d.ts +3 -3
- package/types/server/host-allowlist.d.ts.map +1 -1
- package/types/server/index.d.ts +2 -0
- package/types/server/index.d.ts.map +1 -1
- package/types/server/kay-routes.d.ts +47 -0
- package/types/server/kay-routes.d.ts.map +1 -0
- package/types/server/kay-server.d.ts +25 -0
- package/types/server/kay-server.d.ts.map +1 -0
- package/types/server/kept-exports.d.ts.map +1 -1
- package/types/server/kept-pages.d.ts +1 -1
- package/types/server/kept-pages.d.ts.map +1 -1
- package/types/server/library.d.ts +2 -1
- package/types/server/library.d.ts.map +1 -1
- package/types/server/mcp.d.ts +1 -1
- package/types/server/mcp.d.ts.map +1 -1
- package/types/server/notifications.d.ts +2 -1
- package/types/server/notifications.d.ts.map +1 -1
- package/types/server/offline.d.ts.map +1 -1
- package/types/server/openapi.d.ts.map +1 -1
- package/types/server/phases.d.ts +36 -0
- package/types/server/phases.d.ts.map +1 -0
- package/types/server/protection.d.ts +3 -2
- package/types/server/protection.d.ts.map +1 -1
- package/types/server/proxy-key.d.ts +3 -3
- package/types/server/proxy-key.d.ts.map +1 -1
- package/types/server/push-settings.d.ts +1 -1
- package/types/server/push-settings.d.ts.map +1 -1
- package/types/server/push.d.ts +1 -0
- package/types/server/push.d.ts.map +1 -1
- package/types/server/query.d.ts.map +1 -1
- package/types/server/receive.d.ts +9 -0
- package/types/server/receive.d.ts.map +1 -0
- package/types/server/render-document.d.ts.map +1 -1
- package/types/server/request-context.d.ts +29 -0
- package/types/server/request-context.d.ts.map +1 -0
- package/types/server/schema-check.d.ts +1 -0
- package/types/server/schema-check.d.ts.map +1 -1
- package/types/server/scope.d.ts +1 -1
- package/types/server/scope.d.ts.map +1 -1
- package/types/server/socket.d.ts +3 -5
- package/types/server/socket.d.ts.map +1 -1
- package/types/server/validate.d.ts +26 -0
- package/types/server/validate.d.ts.map +1 -0
- package/types/test/a11y-dom.d.ts +20 -0
- package/types/test/a11y-dom.d.ts.map +1 -0
- package/types/test/html-snapshot.d.ts +4 -0
- package/types/test/html-snapshot.d.ts.map +1 -0
- package/types/test/index.d.ts.map +1 -1
- package/types/test/mount.d.ts +3 -0
- package/types/test/mount.d.ts.map +1 -1
- package/types/test/page-checks.d.ts +6 -0
- package/types/test/page-checks.d.ts.map +1 -0
- package/types/test/screenshot-match.d.ts +1 -1
- package/types/test/screenshot-match.d.ts.map +1 -1
- package/types/test/shared-modules.d.ts.map +1 -1
- package/types/test/site-types.d.ts +3 -1
- package/types/test/site-types.d.ts.map +1 -1
- package/src/check/schema-type.ts +0 -9
- package/src/compiler/deprecated-script-fence.ts +0 -26
- package/src/server/field-errors.ts +0 -136
- package/types/check/schema-type.d.ts +0 -3
- package/types/check/schema-type.d.ts.map +0 -1
- package/types/compiler/deprecated-script-fence.d.ts +0 -3
- package/types/compiler/deprecated-script-fence.d.ts.map +0 -1
- package/types/server/field-errors.d.ts +0 -6
- package/types/server/field-errors.d.ts.map +0 -1
package/dist/eslint.js
CHANGED
|
@@ -25,13 +25,14 @@ var __esm = (fn, res, err) => () => {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
// package.json
|
|
28
|
-
var version = "1.
|
|
28
|
+
var version = "1.107.0", peerDependencies;
|
|
29
29
|
var init_package = __esm(() => {
|
|
30
30
|
peerDependencies = {
|
|
31
31
|
"@happy-dom/global-registrator": "^20.14.6 || ^21.0.3",
|
|
32
32
|
"@kaynooo/pg-orm": "^7.0.0 || ^8.0.0",
|
|
33
33
|
"@types/bun": "^1.4.4",
|
|
34
34
|
"axe-core": "^4.14.0",
|
|
35
|
+
"happy-dom": "^20.14.6 || ^21.0.3",
|
|
35
36
|
typescript7: "npm:typescript@^7.0.2"
|
|
36
37
|
};
|
|
37
38
|
});
|
|
@@ -378,7 +379,7 @@ function formFieldOf(element, source, inherited) {
|
|
|
378
379
|
field.fill = "content";
|
|
379
380
|
else if (element.name === "select")
|
|
380
381
|
field.fill = attributes.has("multiple") ? undefined : "selected";
|
|
381
|
-
else if (inputType === "checkbox" || inputType === "radio")
|
|
382
|
+
else if (inputType === "checkbox" || inputType === "radio" || type === undefined && attributes.has("checked"))
|
|
382
383
|
field.fill = "checked";
|
|
383
384
|
else if (!UNFILLED_TYPES.has(inputType))
|
|
384
385
|
field.fill = "value";
|
|
@@ -1026,6 +1027,18 @@ function rolesOf(source, script, fence) {
|
|
|
1026
1027
|
return { island, client: undefined, pin: undefined };
|
|
1027
1028
|
return island.render === "client" ? { island, client: island.span, pin: undefined } : { island, client: undefined, pin: { kind: island.render, ...island.span } };
|
|
1028
1029
|
}
|
|
1030
|
+
function spelledOutFirstFence(source, line, word) {
|
|
1031
|
+
if (!line || word?.word !== "script" || source.slice(0, line.start).trim() !== "")
|
|
1032
|
+
return [];
|
|
1033
|
+
return [{
|
|
1034
|
+
start: line.start,
|
|
1035
|
+
end: word.end,
|
|
1036
|
+
code: "fence-invalid",
|
|
1037
|
+
message: "`--- script` cannot open a file: the script is written `---`",
|
|
1038
|
+
help: "`--- script` is only for a script that follows a `--- server`, `--- module` or `--- style` fence",
|
|
1039
|
+
fixes: [{ title: "Write `---`", safe: true, edits: [{ start: line.start + 3, end: word.end, text: "" }] }]
|
|
1040
|
+
}];
|
|
1041
|
+
}
|
|
1029
1042
|
var ISLAND_CALL, RENDERS, HYDRATE_TIMINGS, KEYS;
|
|
1030
1043
|
var init_island_declaration = __esm(() => {
|
|
1031
1044
|
init_estree();
|
|
@@ -1226,7 +1239,7 @@ function parseKay(source) {
|
|
|
1226
1239
|
const template = parser.parseTemplate();
|
|
1227
1240
|
if (bareClosing)
|
|
1228
1241
|
explainSecondFence(source, bareClosing, diagnostics);
|
|
1229
|
-
return { source, script: fences.script, server: fences.server, serverFence, module: fences.module, style: fences.style, typeParameters, client, pin, island, scriptLine, templateStart, template, diagnostics, unclosedServer };
|
|
1242
|
+
return { source, script: fences.script, server: fences.server, serverFence, module: fences.module, style: fences.style, typeParameters, client, pin, island, scriptLine, templateStart, template, diagnostics: [...diagnostics, ...spelledOutFirstFence(source, scriptLine, fenceWord)], unclosedServer };
|
|
1230
1243
|
}
|
|
1231
1244
|
function explainSecondFence(source, closing, diagnostics) {
|
|
1232
1245
|
const stray = diagnostics.find((diagnostic) => diagnostic.code === undefined && diagnostic.start >= closing.end && BARE_LINE.test(source.slice(diagnostic.start, diagnostic.end)) && source[diagnostic.start - 1] === `
|
|
@@ -3992,11 +4005,20 @@ function importEdits(file, fence, imports, wanted) {
|
|
|
3992
4005
|
}
|
|
3993
4006
|
return edits;
|
|
3994
4007
|
}
|
|
3995
|
-
|
|
4008
|
+
function withoutComma(src, specifier, declaration) {
|
|
4009
|
+
const after = COMMA_AFTER.exec(src.slice(specifier.end, declaration.end));
|
|
4010
|
+
if (after)
|
|
4011
|
+
return { start: specifier.start, end: specifier.end + after[0].length };
|
|
4012
|
+
const before = COMMA_BEFORE.exec(src.slice(declaration.start, specifier.start));
|
|
4013
|
+
return { start: specifier.start - (before?.[0].length ?? 0), end: specifier.end };
|
|
4014
|
+
}
|
|
4015
|
+
var STARTS_WITH_IMPORT, STARTS_BLANK, PROLOGUE_LINE, COMMA_AFTER, COMMA_BEFORE;
|
|
3996
4016
|
var init_import_edits = __esm(() => {
|
|
3997
4017
|
STARTS_WITH_IMPORT = /^\s*import\b/;
|
|
3998
4018
|
STARTS_BLANK = /^[ \t]*\r?\n/;
|
|
3999
4019
|
PROLOGUE_LINE = /^(?:#!.*|\/\/\/\s*<reference\b.*|[ \t]*(['"])use [\w -]+\1[ \t]*(?:;[ \t]*)?)(?:\r?\n|$)/;
|
|
4020
|
+
COMMA_AFTER = /^\s*,\s*/;
|
|
4021
|
+
COMMA_BEFORE = /,\s*$/;
|
|
4000
4022
|
});
|
|
4001
4023
|
|
|
4002
4024
|
// src/compiler/names.ts
|
|
@@ -4084,7 +4106,7 @@ function childItems(nodes) {
|
|
|
4084
4106
|
if (part.kind === "element")
|
|
4085
4107
|
element(part);
|
|
4086
4108
|
else if (part.kind === "expression")
|
|
4087
|
-
items.push({ kind: "expression", node: part });
|
|
4109
|
+
items.push({ kind: "expression", node: part, line: node });
|
|
4088
4110
|
else if (part.text !== "")
|
|
4089
4111
|
text(part.text);
|
|
4090
4112
|
}
|
|
@@ -4185,8 +4207,8 @@ function fixedSource(element) {
|
|
|
4185
4207
|
const names = (element.fixed ?? "").split(" ").filter((name) => name !== "");
|
|
4186
4208
|
return names.length === 0 ? "" : `, { ${names.map((name) => `${JSON.stringify(name)}: ""`).join(", ")} }`;
|
|
4187
4209
|
}
|
|
4188
|
-
function ambientHelpers(facts) {
|
|
4189
|
-
return facts.ambientForm ? ["formHere", "formError"] : [];
|
|
4210
|
+
function ambientHelpers(facts, mode) {
|
|
4211
|
+
return [...facts.ambientForm ? ["formHere", "formError"] : [], ...mode === "dom" && facts.snippet && facts.forms.size > 0 ? ["issueScope"] : []];
|
|
4190
4212
|
}
|
|
4191
4213
|
var pendingElements;
|
|
4192
4214
|
var init_items = __esm(() => {
|
|
@@ -4582,6 +4604,7 @@ var init_kay_exports = __esm(() => {
|
|
|
4582
4604
|
trustHtml: "shared",
|
|
4583
4605
|
uid: "shared",
|
|
4584
4606
|
untrack: "browser",
|
|
4607
|
+
validate: "shared",
|
|
4585
4608
|
watch: "browser",
|
|
4586
4609
|
webPush: "browser",
|
|
4587
4610
|
withBase: "shared",
|
|
@@ -5374,9 +5397,12 @@ function readsItself(ast, declaration) {
|
|
|
5374
5397
|
return found;
|
|
5375
5398
|
}
|
|
5376
5399
|
function toolOptions(args) {
|
|
5377
|
-
const
|
|
5400
|
+
const isHandler = (arg) => arg?.type === "ArrowFunctionExpression" || arg?.type === "FunctionExpression";
|
|
5401
|
+
const optionsFirst = args[0]?.type === "ObjectExpression" && isHandler(args[1]);
|
|
5402
|
+
const afterHandler = isHandler(args[0]) ? args[1] : args[2];
|
|
5403
|
+
const options = optionsFirst ? args[0] : afterHandler;
|
|
5378
5404
|
let unreadable = options !== undefined && options.type !== "ObjectExpression";
|
|
5379
|
-
for (const arg of args.slice(1)) {
|
|
5405
|
+
for (const arg of args.slice(options === args[0] ? 0 : 1)) {
|
|
5380
5406
|
if (arg.type !== "ObjectExpression")
|
|
5381
5407
|
continue;
|
|
5382
5408
|
const keys = new Map(arg.properties.flatMap((property) => isPlainProperty(property) && !property.computed ? [[keyName(property.key), property.value]] : []));
|
|
@@ -7272,7 +7298,7 @@ class AttributeFixes {
|
|
|
7272
7298
|
if (this.src[start - 1] === ",") {
|
|
7273
7299
|
start--;
|
|
7274
7300
|
} else {
|
|
7275
|
-
const after =
|
|
7301
|
+
const after = COMMA_AFTER2.exec(this.src.slice(end));
|
|
7276
7302
|
if (after)
|
|
7277
7303
|
end += after[0].length;
|
|
7278
7304
|
}
|
|
@@ -7300,13 +7326,13 @@ class AttributeFixes {
|
|
|
7300
7326
|
return this.src.slice(span.start, span.end);
|
|
7301
7327
|
}
|
|
7302
7328
|
}
|
|
7303
|
-
var PART = "[A-Z][\\w-]*", PART_NAME, PART_NAME_LIST, FIELD_NAME2, WHITESPACE_CHAR,
|
|
7329
|
+
var PART = "[A-Z][\\w-]*", PART_NAME, PART_NAME_LIST, FIELD_NAME2, WHITESPACE_CHAR, COMMA_AFTER2, PLAIN_TEXT, QUOTED;
|
|
7304
7330
|
var init_validate_fixes = __esm(() => {
|
|
7305
7331
|
PART_NAME = new RegExp(`^${PART}$`, "i");
|
|
7306
7332
|
PART_NAME_LIST = new RegExp(`^${PART}(?: ${PART})*$`, "i");
|
|
7307
7333
|
FIELD_NAME2 = /^[\w.[\]-]+$/;
|
|
7308
7334
|
WHITESPACE_CHAR = /\s/;
|
|
7309
|
-
|
|
7335
|
+
COMMA_AFTER2 = /^\s*,\s*/;
|
|
7310
7336
|
PLAIN_TEXT = /^[^"'`\\&\n{}<>]*$/;
|
|
7311
7337
|
QUOTED = /^\s*(['"`])([^'"`\\${}\n]*)\1\s*$/;
|
|
7312
7338
|
});
|
|
@@ -8504,7 +8530,7 @@ function dateTypeOf(element, src) {
|
|
|
8504
8530
|
const type = staticAttributeText(element, "type", src)?.toLowerCase();
|
|
8505
8531
|
return type !== undefined && DATE_TYPES.has(type) ? type : undefined;
|
|
8506
8532
|
}
|
|
8507
|
-
function addInitial(b, src, element, values, name, box, separator = " ?? ") {
|
|
8533
|
+
function addInitial(b, src, element, values, name, box, separator = " ?? ", typeVariable) {
|
|
8508
8534
|
if (!values)
|
|
8509
8535
|
return;
|
|
8510
8536
|
b.add(`${separator}${helperName(box ? "formInitialChecked" : "formInitial")}((`).addSource(values).add(`), ${JSON.stringify(name)}`);
|
|
@@ -8515,10 +8541,12 @@ function addInitial(b, src, element, values, name, box, separator = " ?? ") {
|
|
|
8515
8541
|
const type = dateTypeOf(element, src);
|
|
8516
8542
|
if (type !== undefined)
|
|
8517
8543
|
b.add(`, ${JSON.stringify(type)}`);
|
|
8544
|
+
else if (typeVariable !== undefined)
|
|
8545
|
+
b.add(`, ${typeVariable}`);
|
|
8518
8546
|
}
|
|
8519
8547
|
b.add(")");
|
|
8520
8548
|
}
|
|
8521
|
-
function addFilled(b, src, element, { filled, fieldArguments, own, box, values, name }) {
|
|
8549
|
+
function addFilled(b, src, element, { filled, fieldArguments, own, box, values, name, schemaType }) {
|
|
8522
8550
|
b.add(`${helperName("attribute")}(${JSON.stringify(filled)}, ${filled === "value" ? "KayFormValue" : "KayFormChecked"}`);
|
|
8523
8551
|
fieldArguments();
|
|
8524
8552
|
if (filled === "checked") {
|
|
@@ -8530,7 +8558,7 @@ function addFilled(b, src, element, { filled, fieldArguments, own, box, values,
|
|
|
8530
8558
|
b.add(" ?? ");
|
|
8531
8559
|
own();
|
|
8532
8560
|
}
|
|
8533
|
-
addInitial(b, src, element, values, name, filled === "checked" ? { value: box } : undefined);
|
|
8561
|
+
addInitial(b, src, element, values, name, filled === "checked" ? { value: box } : undefined, " ?? ", schemaType ? "KaySchemaType" : undefined);
|
|
8534
8562
|
b.add(")");
|
|
8535
8563
|
}
|
|
8536
8564
|
function addBoxValue(b, src, element, { value }) {
|
|
@@ -8594,6 +8622,58 @@ var init_dom_fields = __esm(() => {
|
|
|
8594
8622
|
init_plan();
|
|
8595
8623
|
});
|
|
8596
8624
|
|
|
8625
|
+
// src/compiler/dom-here.ts
|
|
8626
|
+
class FormHere {
|
|
8627
|
+
names = ["KayHere"];
|
|
8628
|
+
snippets = new Set;
|
|
8629
|
+
count = 0;
|
|
8630
|
+
get current() {
|
|
8631
|
+
return this.names.at(-1);
|
|
8632
|
+
}
|
|
8633
|
+
declared(snippet, src) {
|
|
8634
|
+
this.snippets.add(src.slice(snippet.name.start, snippet.name.end));
|
|
8635
|
+
return snippet;
|
|
8636
|
+
}
|
|
8637
|
+
target(b, form) {
|
|
8638
|
+
if (form)
|
|
8639
|
+
b.add("(").addSource(form).add(")");
|
|
8640
|
+
else
|
|
8641
|
+
b.add(this.current);
|
|
8642
|
+
}
|
|
8643
|
+
scope(b, form) {
|
|
8644
|
+
if (!form)
|
|
8645
|
+
return false;
|
|
8646
|
+
b.add(`${helperName("issueScope")}(`);
|
|
8647
|
+
this.target(b, form);
|
|
8648
|
+
b.add(", () => ");
|
|
8649
|
+
return true;
|
|
8650
|
+
}
|
|
8651
|
+
expression(b, expression, src, form) {
|
|
8652
|
+
const scoped = form !== undefined && src.slice(expression.start, expression.end).match(CALLED)?.some((name) => this.snippets.has(name)) === true;
|
|
8653
|
+
if (scoped)
|
|
8654
|
+
this.scope(b, form);
|
|
8655
|
+
b.add("(").addSource(expression).add(scoped ? "))" : ")");
|
|
8656
|
+
}
|
|
8657
|
+
within(b, nodes, forms, children) {
|
|
8658
|
+
if (!someNode(nodes, (line) => (line.kind === "error" || line.kind === "pending") && !forms.has(line))) {
|
|
8659
|
+
children();
|
|
8660
|
+
return;
|
|
8661
|
+
}
|
|
8662
|
+
const own = `KayHere${++this.count}`;
|
|
8663
|
+
b.add(`(() => { const ${own} = ${helperName("formHere")}() ?? ${this.current}; return `);
|
|
8664
|
+
this.names.push(own);
|
|
8665
|
+
children();
|
|
8666
|
+
this.names.pop();
|
|
8667
|
+
b.add("; })()");
|
|
8668
|
+
}
|
|
8669
|
+
}
|
|
8670
|
+
var CALLED;
|
|
8671
|
+
var init_dom_here = __esm(() => {
|
|
8672
|
+
init_ast();
|
|
8673
|
+
init_markup();
|
|
8674
|
+
CALLED = /[a-z_$][\w$]*(?=\s*\()/gi;
|
|
8675
|
+
});
|
|
8676
|
+
|
|
8597
8677
|
// src/compiler/style-arguments.ts
|
|
8598
8678
|
function addStyleArguments(b, attribute) {
|
|
8599
8679
|
if (attribute.expression)
|
|
@@ -8631,7 +8711,7 @@ function awaitAlertTail(alert, target) {
|
|
|
8631
8711
|
var HTML_HELPERS, DOM_HELPERS, APART;
|
|
8632
8712
|
var init_helper_imports = __esm(() => {
|
|
8633
8713
|
init_markup();
|
|
8634
|
-
HTML_HELPERS = ["attempt", "attribute", "checkedMarkup", "child", "className", "component", "componentClass", "currentPage", "dynamic", "element", "errorParagraph", "fieldDescribed", "formConstraints", "formKey", "head", "html", "imageAttributes", "innerMarkup", "leadingNewline", "linkHref", "localHref", "loop", "memo", "merge", "nonEmptyAttribute", "omit", "outsideLink", "partClass", "partHanded", "partsClass", "raw", "rawData", "rawTyped", "refillOptions", "selectOptions", "serverIsland", "show", "spreadAttributes", "spreadWith", "style", "untrack"];
|
|
8714
|
+
HTML_HELPERS = ["attempt", "attribute", "checkedMarkup", "child", "className", "component", "componentClass", "currentPage", "dynamic", "element", "errorParagraph", "fieldDescribed", "formConstraints", "formKey", "formOptions", "formType", "head", "html", "imageAttributes", "innerMarkup", "leadingNewline", "linkHref", "localHref", "loop", "memo", "merge", "nonEmptyAttribute", "omit", "outsideLink", "partClass", "partHanded", "partsClass", "raw", "rawData", "rawTyped", "refillOptions", "schemaFill", "selectOptions", "serverIsland", "show", "spreadAttributes", "spreadWith", "style", "untrack"];
|
|
8635
8715
|
DOM_HELPERS = ["append", "attribute", "branches", "checkedMarkup", "choose", "close", "component", "componentClass", "effect", "errorParagraph", "fragment", "holdSubmits", "insert", "listen", "listenSubmit", "listenSubmitWith", "listenWith", "markers", "memo", "merge", "omit", "outside", "part", "partClass", "partHanded", "partsClass", "property", "ref", "setClass", "setStyle", "spreadAttributes", "spreadWith", "template", "text", "transition", "untrack"];
|
|
8636
8716
|
APART = [["kay/dom-loop", ["loop", "rowKey"]], ["kay/dom-await", ["awaited"]], ["kay/dom-try", ["attempt"]], ["kay/dom-spread", ["dynamic", "spread"]], ["kay/dom-image", ["image"]], ["kay/pending", ["pendingCall"]]];
|
|
8637
8717
|
});
|
|
@@ -8642,6 +8722,7 @@ var init_dom = __esm(() => {
|
|
|
8642
8722
|
init_outside();
|
|
8643
8723
|
init_ast();
|
|
8644
8724
|
init_dom_fields();
|
|
8725
|
+
init_dom_here();
|
|
8645
8726
|
init_event_modifiers();
|
|
8646
8727
|
init_expression();
|
|
8647
8728
|
init_items();
|
|
@@ -8662,6 +8743,7 @@ var init_dom = __esm(() => {
|
|
|
8662
8743
|
constBlocks = 0;
|
|
8663
8744
|
catches = [];
|
|
8664
8745
|
writesLinks = false;
|
|
8746
|
+
here = new FormHere;
|
|
8665
8747
|
constructor(b, src, facts, ownMarkup, errors, located, classTable, awaitAlert = "") {
|
|
8666
8748
|
super(b, src, facts, ownMarkup);
|
|
8667
8749
|
this.errors = errors;
|
|
@@ -8722,7 +8804,9 @@ var init_dom = __esm(() => {
|
|
|
8722
8804
|
const at = `${element}, ${start}, ${end}`;
|
|
8723
8805
|
switch (item.kind) {
|
|
8724
8806
|
case "expression":
|
|
8725
|
-
b.add(`KayInsert(${at}, () =>
|
|
8807
|
+
b.add(`KayInsert(${at}, () => `);
|
|
8808
|
+
this.here.expression(b, item.node.expression, this.src, this.formOf(item.line));
|
|
8809
|
+
b.add(");");
|
|
8726
8810
|
break;
|
|
8727
8811
|
case "component":
|
|
8728
8812
|
b.wrap(item.node, () => {
|
|
@@ -8772,22 +8856,20 @@ var init_dom = __esm(() => {
|
|
|
8772
8856
|
b.wrap(item.node, () => this.try(item.node, at));
|
|
8773
8857
|
break;
|
|
8774
8858
|
case "error":
|
|
8775
|
-
|
|
8859
|
+
b.wrap(item.node, () => {
|
|
8776
8860
|
const target = this.formOf(item.node);
|
|
8777
|
-
b.
|
|
8778
|
-
|
|
8779
|
-
});
|
|
8780
|
-
}
|
|
8781
|
-
b.add(`{ const KayHere = ${helperName("formHere")}(); KayInsert(${at}, () => ${helperName("errorParagraph")}(${helperName("formError")}(KayHere, ${JSON.stringify(item.node.name)}), ${errorParagraphArguments(item.node, this.src, undefined)})); }`);
|
|
8782
|
-
}
|
|
8861
|
+
b.add(`KayInsert(${at}, () => ${helperName("errorParagraph")}(${helperName("formError")}(`);
|
|
8862
|
+
this.here.target(b, target);
|
|
8863
|
+
b.add(`, ${JSON.stringify(item.node.name)}), ${errorParagraphArguments(item.node, this.src, target ? this.errors?.lines.get(item.node) : undefined)}));`);
|
|
8864
|
+
});
|
|
8783
8865
|
break;
|
|
8784
8866
|
}
|
|
8785
8867
|
}
|
|
8786
8868
|
declaration(item) {
|
|
8787
|
-
if (item.kind === "
|
|
8788
|
-
this.snippetDeclaration(item.node);
|
|
8789
|
-
else
|
|
8869
|
+
if (item.kind === "const")
|
|
8790
8870
|
this.b.wrap(item.node, () => constDeclaration(this.b, item.node, this.src, helperName("memo")));
|
|
8871
|
+
else
|
|
8872
|
+
this.snippetDeclaration(this.here.declared(item.node, this.src));
|
|
8791
8873
|
}
|
|
8792
8874
|
if(node, at) {
|
|
8793
8875
|
const { b } = this;
|
|
@@ -8948,10 +9030,9 @@ var init_dom = __esm(() => {
|
|
|
8948
9030
|
followCalls(pending, node) {
|
|
8949
9031
|
const followed = this.formOf(pending);
|
|
8950
9032
|
return (variable) => {
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
this.b.add(`{ const KayHere = ${helperName("formHere")}(); KayEffect(() => ${helperName("pendingCall")}(${variable(node)}, KayHere)); }`);
|
|
9033
|
+
this.b.add(`KayEffect(() => ${helperName("pendingCall")}(${variable(node)}, `);
|
|
9034
|
+
this.here.target(this.b, followed);
|
|
9035
|
+
this.b.add("));");
|
|
8955
9036
|
};
|
|
8956
9037
|
}
|
|
8957
9038
|
templateOf(element, node, bindings) {
|
|
@@ -9190,16 +9271,15 @@ var init_dom = __esm(() => {
|
|
|
9190
9271
|
const form = this.formOf(element);
|
|
9191
9272
|
if (holds)
|
|
9192
9273
|
b.add(`(${helperName("holdSubmits")}(), `);
|
|
9193
|
-
|
|
9194
|
-
b.add(`${helperName(this.scoping)}((`).addSource(form).add("), () => ");
|
|
9274
|
+
const scoped = this.here.scope(b, form);
|
|
9195
9275
|
b.add(dynamic ? "KayDynamic(" : "KayComponent(").addSource(element.tag).add(", ");
|
|
9196
9276
|
this.componentProps(element, true);
|
|
9197
9277
|
b.add(holds ? "))" : ")");
|
|
9198
|
-
if (
|
|
9278
|
+
if (scoped)
|
|
9199
9279
|
b.add(")");
|
|
9200
9280
|
}
|
|
9201
9281
|
rendered(nodes) {
|
|
9202
|
-
this.block(nodes);
|
|
9282
|
+
this.here.within(this.b, nodes, this.facts.forms, () => this.block(nodes));
|
|
9203
9283
|
}
|
|
9204
9284
|
skips(element, name) {
|
|
9205
9285
|
return marksServerIsland(element, name, this.src);
|
|
@@ -9272,9 +9352,9 @@ var init_head = __esm(() => {
|
|
|
9272
9352
|
});
|
|
9273
9353
|
|
|
9274
9354
|
// src/compiler/field-described.ts
|
|
9275
|
-
function addFieldDescribed(b, own, type, aria, refusing) {
|
|
9355
|
+
function addFieldDescribed(b, own, type, aria, refusing, schemaType) {
|
|
9276
9356
|
const expression = (attribute) => attribute?.kind === "value" ? () => b.add("(").addSource(attribute.expression).add(")") : undefined;
|
|
9277
|
-
const typed = type?.kind === "text" ? () => b.add(JSON.stringify(type.text)) : expression(type);
|
|
9357
|
+
const typed = type?.kind === "text" ? () => b.add(JSON.stringify(type.text)) : expression(type) ?? schemaType;
|
|
9278
9358
|
const written = expression(aria?.required) ?? (aria?.required || aria?.unrequirable ? () => b.add("true") : undefined);
|
|
9279
9359
|
const native = expression(aria?.native) ?? (aria?.native ? () => b.add("true") : undefined);
|
|
9280
9360
|
const refused = refusing && (() => {
|
|
@@ -9306,6 +9386,66 @@ var init_field_described = __esm(() => {
|
|
|
9306
9386
|
init_markup();
|
|
9307
9387
|
});
|
|
9308
9388
|
|
|
9389
|
+
// src/compiler/html-fields.ts
|
|
9390
|
+
function addClassAttribute(b, markup, classes, classList) {
|
|
9391
|
+
if (classes?.parts) {
|
|
9392
|
+
const parts = classes;
|
|
9393
|
+
markup.dynamic(() => {
|
|
9394
|
+
b.add(`${helperName("nonEmptyAttribute")}("class", ${helperName("className")}(`);
|
|
9395
|
+
classList(parts);
|
|
9396
|
+
b.add("))");
|
|
9397
|
+
});
|
|
9398
|
+
} else if (classes?.expression) {
|
|
9399
|
+
const { text, expression } = classes;
|
|
9400
|
+
markup.text(' class="');
|
|
9401
|
+
markup.dynamic(() => b.add(`${helperName("className")}([${JSON.stringify(text)}, (`).addSource(expression).add(")])"));
|
|
9402
|
+
markup.text('"');
|
|
9403
|
+
} else if (classes?.pieces) {
|
|
9404
|
+
const { pieces } = classes;
|
|
9405
|
+
markup.text(' class="');
|
|
9406
|
+
markup.dynamic(() => b.add(`${helperName("className")}(${JSON.stringify(pieces)})`));
|
|
9407
|
+
markup.text('"');
|
|
9408
|
+
} else if (classes) {
|
|
9409
|
+
markup.text(` class="${escapeStaticAttribute(classes.text)}"`);
|
|
9410
|
+
}
|
|
9411
|
+
}
|
|
9412
|
+
function addFieldFill(b, src, element, markup, fill, field, typed) {
|
|
9413
|
+
const one = (filled, box = fill.box, schemaType = true) => addFilled(b, src, element, { ...fill, filled, box, own: filled === fill.filled ? fill.own : undefined, schemaType });
|
|
9414
|
+
if (!(typed && field.marked && fill.filled === "value")) {
|
|
9415
|
+
markup.dynamic(() => one(fill.filled, fill.box, false));
|
|
9416
|
+
return;
|
|
9417
|
+
}
|
|
9418
|
+
markup.dynamic(() => {
|
|
9419
|
+
b.add(helperName("schemaFill"));
|
|
9420
|
+
fill.fieldArguments();
|
|
9421
|
+
b.add(", (KaySchemaType) => ");
|
|
9422
|
+
one("value");
|
|
9423
|
+
b.add(", () => ");
|
|
9424
|
+
one("checked", fill.own);
|
|
9425
|
+
if (fill.own) {
|
|
9426
|
+
b.add(` + ${helperName("attribute")}("value", `);
|
|
9427
|
+
fill.own();
|
|
9428
|
+
b.add(")");
|
|
9429
|
+
}
|
|
9430
|
+
b.add(")");
|
|
9431
|
+
});
|
|
9432
|
+
}
|
|
9433
|
+
function schemaTypeCall(b, element, type, field, target) {
|
|
9434
|
+
if (element !== "input" || type !== undefined || !field?.marked || !target)
|
|
9435
|
+
return;
|
|
9436
|
+
return () => void b.add(`${helperName("formType")}((`).addSource(target).add(`), ${JSON.stringify(field.name)})`);
|
|
9437
|
+
}
|
|
9438
|
+
function listsFromSchema(element, children, field) {
|
|
9439
|
+
return element === "select" && children.length === 0 && field?.marked === true;
|
|
9440
|
+
}
|
|
9441
|
+
function addSchemaOptions(b, target, name) {
|
|
9442
|
+
b.add(`${helperName("formOptions")}((`).addSource(target).add(`), ${JSON.stringify(name)})`);
|
|
9443
|
+
}
|
|
9444
|
+
var init_html_fields = __esm(() => {
|
|
9445
|
+
init_html_initial();
|
|
9446
|
+
init_markup();
|
|
9447
|
+
});
|
|
9448
|
+
|
|
9309
9449
|
// src/compiler/html-parts.ts
|
|
9310
9450
|
class Markup {
|
|
9311
9451
|
b;
|
|
@@ -9362,6 +9502,7 @@ var init_html = __esm(() => {
|
|
|
9362
9502
|
init_expression();
|
|
9363
9503
|
init_field_described();
|
|
9364
9504
|
init_form_info();
|
|
9505
|
+
init_html_fields();
|
|
9365
9506
|
init_html_initial();
|
|
9366
9507
|
init_items();
|
|
9367
9508
|
init_markup();
|
|
@@ -9674,33 +9815,15 @@ var init_html = __esm(() => {
|
|
|
9674
9815
|
const describable = fieldAria !== undefined;
|
|
9675
9816
|
let ownDescribed;
|
|
9676
9817
|
let refusing;
|
|
9677
|
-
const
|
|
9818
|
+
const schemaType = schemaTypeCall(b, name, type, field, target);
|
|
9819
|
+
const fieldDescribed = (own, refusing) => addFieldDescribed(b, own, type, fieldAria, refusing, schemaType);
|
|
9678
9820
|
markup.text(`<${name}${element.fixed ?? ""}`);
|
|
9679
9821
|
if (plan.id !== undefined)
|
|
9680
9822
|
markup.text(` id="${escapeStaticAttribute(plan.id)}"`);
|
|
9681
9823
|
const unit = this.options.kept?.groups.get(element.start);
|
|
9682
9824
|
if (unit !== undefined)
|
|
9683
9825
|
markup.text(` data-kay-u="${unit.id}"`);
|
|
9684
|
-
|
|
9685
|
-
const classes = plan.classes;
|
|
9686
|
-
markup.dynamic(() => {
|
|
9687
|
-
b.add(`${helperName("nonEmptyAttribute")}("class", ${helperName("className")}(`);
|
|
9688
|
-
this.classList(classes);
|
|
9689
|
-
b.add("))");
|
|
9690
|
-
});
|
|
9691
|
-
} else if (plan.classes?.expression) {
|
|
9692
|
-
const { text, expression } = plan.classes;
|
|
9693
|
-
markup.text(' class="');
|
|
9694
|
-
markup.dynamic(() => b.add(`${helperName("className")}([${JSON.stringify(text)}, (`).addSource(expression).add(")])"));
|
|
9695
|
-
markup.text('"');
|
|
9696
|
-
} else if (plan.classes?.pieces) {
|
|
9697
|
-
const { pieces } = plan.classes;
|
|
9698
|
-
markup.text(' class="');
|
|
9699
|
-
markup.dynamic(() => b.add(`${helperName("className")}(${JSON.stringify(pieces)})`));
|
|
9700
|
-
markup.text('"');
|
|
9701
|
-
} else if (plan.classes) {
|
|
9702
|
-
markup.text(` class="${escapeStaticAttribute(plan.classes.text)}"`);
|
|
9703
|
-
}
|
|
9826
|
+
addClassAttribute(b, markup, plan.classes, (classes) => this.classList(classes));
|
|
9704
9827
|
for (const attribute of plan.attributes) {
|
|
9705
9828
|
if (attribute.kind === "binding") {
|
|
9706
9829
|
const { binding } = attribute;
|
|
@@ -9812,7 +9935,7 @@ var init_html = __esm(() => {
|
|
|
9812
9935
|
});
|
|
9813
9936
|
}
|
|
9814
9937
|
if (filled)
|
|
9815
|
-
|
|
9938
|
+
addFieldFill(b, this.src, element, markup, { filled, fieldArguments, own: ownFill, box: checkboxValue, values, name: field.name }, field, name === "input" && !this.named(element, "type"));
|
|
9816
9939
|
if (field.invalid) {
|
|
9817
9940
|
refusing = fieldArguments;
|
|
9818
9941
|
markup.dynamic(() => addInvalidAttribute(b, fieldArguments));
|
|
@@ -9872,11 +9995,15 @@ var init_html = __esm(() => {
|
|
|
9872
9995
|
rawText = "raw";
|
|
9873
9996
|
}
|
|
9874
9997
|
const staticContent = field?.fill === "content" && plan.valueText !== undefined ? undefined : plan.staticContent;
|
|
9875
|
-
|
|
9998
|
+
const fromSchema = listsFromSchema(name, children, field);
|
|
9999
|
+
if (field && (fromSchema || children.length > 0 && field.fill === "selected") && target) {
|
|
9876
10000
|
const own = selected;
|
|
9877
10001
|
markup.dynamic(() => {
|
|
9878
10002
|
b.add(`${helperName("refillOptions")}(KayFormValue((`).addSource(target).add(`), ${JSON.stringify(field.name)}), `);
|
|
9879
|
-
|
|
10003
|
+
if (fromSchema)
|
|
10004
|
+
addSchemaOptions(b, target, field.name);
|
|
10005
|
+
else
|
|
10006
|
+
this.markup(children, true);
|
|
9880
10007
|
if (own) {
|
|
9881
10008
|
b.add(", () => ");
|
|
9882
10009
|
own();
|
|
@@ -10570,7 +10697,7 @@ class JsxTemplate {
|
|
|
10570
10697
|
const text = (span) => this.src.slice(span.start, span.end).trim();
|
|
10571
10698
|
const subject = text(node.subject);
|
|
10572
10699
|
const unmatched = this.options.check && !fallback && !TYPED_SUBJECT.test(subject) && node.cases.every((branch) => branch.values.every((value) => UNIT_VALUE.test(text(value))));
|
|
10573
|
-
const called =
|
|
10700
|
+
const called = CALLED2.test(subject);
|
|
10574
10701
|
b.add("(() => { ");
|
|
10575
10702
|
if (unmatched && called)
|
|
10576
10703
|
b.add("const kayMatched = (").addSource(node.subject).add("); switch (kayMatched) { ");
|
|
@@ -11088,7 +11215,7 @@ class JsxTemplate {
|
|
|
11088
11215
|
return this.src.slice(span.start, span.end);
|
|
11089
11216
|
}
|
|
11090
11217
|
}
|
|
11091
|
-
var
|
|
11218
|
+
var CALLED2, TYPED_SUBJECT, UNIT_VALUE, JSX_TEXT_ESCAPES, MARKUP_ATTRIBUTES, EVENT_HANDLER2, PLAIN_PARAMETER;
|
|
11092
11219
|
var init_jsx = __esm(() => {
|
|
11093
11220
|
init_ast();
|
|
11094
11221
|
init_expression();
|
|
@@ -11100,7 +11227,7 @@ var init_jsx = __esm(() => {
|
|
|
11100
11227
|
init_names();
|
|
11101
11228
|
init_plan();
|
|
11102
11229
|
init_validate();
|
|
11103
|
-
|
|
11230
|
+
CALLED2 = /[\w$\])]\s*\(/;
|
|
11104
11231
|
TYPED_SUBJECT = /^(?:typeof\s|true$|false$)/;
|
|
11105
11232
|
UNIT_VALUE = /^(?:'[^'\\]*'|"[^"\\]*"|-?\d[\w.]*|true|false|null|undefined|[A-Z][\w$]*(?:\.[a-z_$][\w$]*)+)$/i;
|
|
11106
11233
|
JSX_TEXT_ESCAPES = /[{}<>]|[ \t]{2,}/g;
|
|
@@ -11109,6 +11236,233 @@ var init_jsx = __esm(() => {
|
|
|
11109
11236
|
PLAIN_PARAMETER = /^[\p{ID_Start}$_][\p{ID_Continue}$\u200C\u200D]*$/u;
|
|
11110
11237
|
});
|
|
11111
11238
|
|
|
11239
|
+
// src/compiler/lazy-imports.ts
|
|
11240
|
+
function occurrences(text, name) {
|
|
11241
|
+
return text.match(new RegExp(`(?<![\\w$.])${name.replaceAll("$", "\\$")}(?![\\w$])`, "g"))?.length ?? 0;
|
|
11242
|
+
}
|
|
11243
|
+
|
|
11244
|
+
class Positions {
|
|
11245
|
+
source;
|
|
11246
|
+
deferring;
|
|
11247
|
+
visit;
|
|
11248
|
+
repeating = 0;
|
|
11249
|
+
constructor(source, deferring, visit) {
|
|
11250
|
+
this.source = source;
|
|
11251
|
+
this.deferring = deferring;
|
|
11252
|
+
this.visit = visit;
|
|
11253
|
+
}
|
|
11254
|
+
exhaustive(branches, deferred) {
|
|
11255
|
+
const real = this.visit;
|
|
11256
|
+
const calls = branches.map((children) => {
|
|
11257
|
+
const seen = [];
|
|
11258
|
+
this.visit = {
|
|
11259
|
+
use: (element, inner) => seen.push({ name: element.name, element, deferred: inner, outlet: false }),
|
|
11260
|
+
outlet: (element, inner) => seen.push({ name: element.outlet ? this.source.slice(element.outlet.name.start, element.outlet.name.end) : CHILDREN, element, deferred: inner, outlet: true })
|
|
11261
|
+
};
|
|
11262
|
+
this.walk(children, deferred);
|
|
11263
|
+
return seen;
|
|
11264
|
+
});
|
|
11265
|
+
this.visit = real;
|
|
11266
|
+
const keyOf = (call) => `${call.outlet}:${call.name}`;
|
|
11267
|
+
const everywhere = calls.map((seen) => new Set(seen.map(keyOf)));
|
|
11268
|
+
for (const call of calls.flat()) {
|
|
11269
|
+
const always = everywhere.every((names) => names.has(keyOf(call)));
|
|
11270
|
+
if (call.outlet)
|
|
11271
|
+
real.outlet?.(call.element, call.deferred || !always && this.repeating === 0);
|
|
11272
|
+
else
|
|
11273
|
+
real.use?.(call.element, call.deferred || !always && this.repeating === 0);
|
|
11274
|
+
}
|
|
11275
|
+
}
|
|
11276
|
+
walk(nodes, deferred) {
|
|
11277
|
+
for (const node of nodes) {
|
|
11278
|
+
switch (node.kind) {
|
|
11279
|
+
case "element":
|
|
11280
|
+
this.element(node, deferred);
|
|
11281
|
+
break;
|
|
11282
|
+
case "if":
|
|
11283
|
+
if (node.fallback) {
|
|
11284
|
+
this.exhaustive([...node.branches.map((branch) => branch.children), node.fallback.children], deferred);
|
|
11285
|
+
break;
|
|
11286
|
+
}
|
|
11287
|
+
for (const branch of node.branches)
|
|
11288
|
+
this.walk(branch.children, deferred || this.repeating === 0);
|
|
11289
|
+
break;
|
|
11290
|
+
case "match":
|
|
11291
|
+
if (node.fallback) {
|
|
11292
|
+
this.exhaustive([...node.cases.map((branch) => branch.children), node.fallback.children], deferred);
|
|
11293
|
+
break;
|
|
11294
|
+
}
|
|
11295
|
+
for (const branch of node.cases)
|
|
11296
|
+
this.walk(branch.children, deferred || this.repeating === 0);
|
|
11297
|
+
break;
|
|
11298
|
+
case "for":
|
|
11299
|
+
this.repeating++;
|
|
11300
|
+
this.walk(node.children, deferred);
|
|
11301
|
+
this.repeating--;
|
|
11302
|
+
this.walk(node.fallback ?? [], deferred);
|
|
11303
|
+
break;
|
|
11304
|
+
case "await":
|
|
11305
|
+
this.walk(node.pending, deferred);
|
|
11306
|
+
this.walk(node.resolved?.children ?? [], deferred);
|
|
11307
|
+
this.walk(node.rejected?.children ?? [], true);
|
|
11308
|
+
break;
|
|
11309
|
+
case "try":
|
|
11310
|
+
this.walk(node.children, deferred);
|
|
11311
|
+
this.walk(node.rejected?.children ?? [], true);
|
|
11312
|
+
break;
|
|
11313
|
+
case "text":
|
|
11314
|
+
this.walk(node.parts.filter((part) => part.kind === "element"), deferred);
|
|
11315
|
+
break;
|
|
11316
|
+
case "slot":
|
|
11317
|
+
case "snippet":
|
|
11318
|
+
case "pending":
|
|
11319
|
+
this.walk(node.children, deferred);
|
|
11320
|
+
break;
|
|
11321
|
+
case "const":
|
|
11322
|
+
case "error":
|
|
11323
|
+
break;
|
|
11324
|
+
}
|
|
11325
|
+
}
|
|
11326
|
+
}
|
|
11327
|
+
element(element, deferred) {
|
|
11328
|
+
if (element.component)
|
|
11329
|
+
this.visit.use?.(element, deferred);
|
|
11330
|
+
else if (element.name === "slot")
|
|
11331
|
+
this.visit.outlet?.(element, deferred);
|
|
11332
|
+
const props = element.component ? this.deferring(element) : [];
|
|
11333
|
+
for (const child of element.children) {
|
|
11334
|
+
const own = child.kind === "slot" ? this.source.slice(child.name.start, child.name.end) : CHILDREN;
|
|
11335
|
+
const repeated = child.kind === "slot" && child.params !== undefined;
|
|
11336
|
+
this.repeating += repeated ? 1 : 0;
|
|
11337
|
+
this.walk(child.kind === "slot" ? child.children : [child], deferred || props.includes(own));
|
|
11338
|
+
this.repeating -= repeated ? 1 : 0;
|
|
11339
|
+
}
|
|
11340
|
+
}
|
|
11341
|
+
}
|
|
11342
|
+
function codeOf2(file) {
|
|
11343
|
+
const blanks = [];
|
|
11344
|
+
visitNodes(file.template, (node) => {
|
|
11345
|
+
if (node.kind === "text")
|
|
11346
|
+
blanks.push(...node.parts.filter((part) => part.kind === "chunk"));
|
|
11347
|
+
else if (node.kind === "element")
|
|
11348
|
+
blanks.push(...node.attributes.flatMap((attribute) => attribute.kind === "static" ? [attribute.value] : []));
|
|
11349
|
+
});
|
|
11350
|
+
let code = file.source;
|
|
11351
|
+
for (const { start, end } of blanks)
|
|
11352
|
+
code = `${code.slice(0, start)}${" ".repeat(end - start)}${code.slice(end)}`;
|
|
11353
|
+
return blankLiterals(code);
|
|
11354
|
+
}
|
|
11355
|
+
function blankLiterals(code) {
|
|
11356
|
+
const blank = (text) => " ".repeat(text.length);
|
|
11357
|
+
return code.split(`
|
|
11358
|
+
`).map((line) => {
|
|
11359
|
+
if (LINE_COMMENT.test(line))
|
|
11360
|
+
return blank(line);
|
|
11361
|
+
return UNSURE_LINE.test(line) ? line : line.replace(PLAIN_STRING, blank);
|
|
11362
|
+
}).join(`
|
|
11363
|
+
`);
|
|
11364
|
+
}
|
|
11365
|
+
function lazyImports(file, imports, known) {
|
|
11366
|
+
const found = positionsLazy(file, imports, known);
|
|
11367
|
+
for (let changed = found.size > 0;changed; ) {
|
|
11368
|
+
const held = new Set(eagerReach(imports, known, found));
|
|
11369
|
+
changed = false;
|
|
11370
|
+
for (const [local, lazy] of found) {
|
|
11371
|
+
if (held.has(lazy.key)) {
|
|
11372
|
+
found.delete(local);
|
|
11373
|
+
changed = true;
|
|
11374
|
+
}
|
|
11375
|
+
}
|
|
11376
|
+
}
|
|
11377
|
+
return found;
|
|
11378
|
+
}
|
|
11379
|
+
function eagerReach(imports, known, lazy) {
|
|
11380
|
+
const reach = new Set;
|
|
11381
|
+
for (const binding of imports) {
|
|
11382
|
+
const component = binding.imported === "default" && !binding.typeOnly ? known[binding.source] : undefined;
|
|
11383
|
+
if (component && !lazy.has(binding.local)) {
|
|
11384
|
+
reach.add(component.key);
|
|
11385
|
+
for (const key of component.reach)
|
|
11386
|
+
reach.add(key);
|
|
11387
|
+
}
|
|
11388
|
+
}
|
|
11389
|
+
return [...reach];
|
|
11390
|
+
}
|
|
11391
|
+
function positionsLazy(file, imports, known) {
|
|
11392
|
+
const candidates = new Map;
|
|
11393
|
+
const specifiers = new Map;
|
|
11394
|
+
for (const binding of imports) {
|
|
11395
|
+
if (binding.imported !== "default" || binding.typeOnly)
|
|
11396
|
+
continue;
|
|
11397
|
+
specifiers.set(binding.local, binding.source);
|
|
11398
|
+
const declared = file.source.slice(binding.declaration.start, binding.declaration.end);
|
|
11399
|
+
if ((known[binding.source]?.size ?? 0) >= LAZY_FLOOR && PLAIN_IMPORT.test(declared))
|
|
11400
|
+
candidates.set(binding.local, { binding, uses: [] });
|
|
11401
|
+
}
|
|
11402
|
+
if (candidates.size === 0)
|
|
11403
|
+
return new Map;
|
|
11404
|
+
const refused = new Set;
|
|
11405
|
+
new Positions(file.source, (element) => {
|
|
11406
|
+
const specifier = specifiers.get(element.name);
|
|
11407
|
+
return specifier === undefined ? [] : known[specifier]?.deferred ?? [];
|
|
11408
|
+
}, {
|
|
11409
|
+
use(element, deferred) {
|
|
11410
|
+
const candidate = candidates.get(element.name);
|
|
11411
|
+
if (!candidate)
|
|
11412
|
+
return;
|
|
11413
|
+
candidate.uses.push(deferred);
|
|
11414
|
+
if (serverIslandOf(element, file.source) !== undefined)
|
|
11415
|
+
refused.add(element.name);
|
|
11416
|
+
}
|
|
11417
|
+
}).walk(file.template, false);
|
|
11418
|
+
const code = codeOf2(file);
|
|
11419
|
+
const found = new Map;
|
|
11420
|
+
for (const [local, { binding, uses }] of candidates) {
|
|
11421
|
+
const written = occurrences(code, local) - 1;
|
|
11422
|
+
if (uses.length === 0 || !uses.every(Boolean) || refused.has(local) || written !== uses.length)
|
|
11423
|
+
continue;
|
|
11424
|
+
found.set(local, { key: known[binding.source].key, specifier: binding.source, declaration: binding.declaration });
|
|
11425
|
+
}
|
|
11426
|
+
return found;
|
|
11427
|
+
}
|
|
11428
|
+
function lazyImportsOf(file, imports, options, hydrated, routeFile, clientOnly) {
|
|
11429
|
+
return options.components !== undefined && !(routeFile || clientOnly) && (options.output === "dom" || hydrated) ? lazyImports(file, imports, options.components) : undefined;
|
|
11430
|
+
}
|
|
11431
|
+
function lazyNoteImport(lazy, mode) {
|
|
11432
|
+
return mode === "html" && (lazy?.size ?? 0) > 0 ? `import { lazyNote as ${helperName("lazyNote")} } from 'kay/island'
|
|
11433
|
+
` : "";
|
|
11434
|
+
}
|
|
11435
|
+
function lazyDomImport(lazy) {
|
|
11436
|
+
return (lazy?.size ?? 0) > 0 ? `import { lazy as ${helperName("lazy")}, ready as ${helperName("ready")} } from 'kay/dom-lazy'
|
|
11437
|
+
` : "";
|
|
11438
|
+
}
|
|
11439
|
+
function lazyEdits(imports, span, lazy, mode, moduleId) {
|
|
11440
|
+
if (mode !== "dom" && mode !== "html")
|
|
11441
|
+
return [];
|
|
11442
|
+
const last = Math.max(-1, ...[...lazy?.values() ?? []].map((other) => other.declaration.start));
|
|
11443
|
+
return imports.flatMap((binding) => {
|
|
11444
|
+
const found = lazy?.get(binding.local);
|
|
11445
|
+
if (!found || binding.declaration.start < span.start || binding.declaration.end > span.end)
|
|
11446
|
+
return [];
|
|
11447
|
+
const key = JSON.stringify(found.key);
|
|
11448
|
+
const specifier = JSON.stringify(found.specifier);
|
|
11449
|
+
const eager = `${helperName("lazy")}_${binding.local}`;
|
|
11450
|
+
const ready = found.declaration.start === last ? `
|
|
11451
|
+
${helperName("ready")}(${JSON.stringify(moduleId)}, ${JSON.stringify([...lazy?.values() ?? []].map((other) => other.key))})` : "";
|
|
11452
|
+
return [{ ...found.declaration, text: mode === "dom" ? `const ${binding.local} = ${helperName("lazy")}(${key}, () => import(${specifier}))${ready}` : `import ${eager} from ${specifier}
|
|
11453
|
+
const ${binding.local} = ${helperName("lazyNote")}(${key}, () => ${eager})` }];
|
|
11454
|
+
});
|
|
11455
|
+
}
|
|
11456
|
+
var LAZY_FLOOR = 2000, CHILDREN = "children", LINE_COMMENT, PLAIN_STRING, UNSURE_LINE, PLAIN_IMPORT;
|
|
11457
|
+
var init_lazy_imports = __esm(() => {
|
|
11458
|
+
init_ast();
|
|
11459
|
+
init_markup();
|
|
11460
|
+
LINE_COMMENT = /^[ \t]*\/\/.*$/;
|
|
11461
|
+
PLAIN_STRING = /'(?:[^'\\\n$`]|\\.)*'|"(?:[^"\\\n$`]|\\.)*"/g;
|
|
11462
|
+
UNSURE_LINE = /`|[(,=:?!&|{;[]\s*\/(?![/*])/;
|
|
11463
|
+
PLAIN_IMPORT = /^import\s+[\w$]+\s+from\s*(['"])[^'"]+\1\s*;?$/;
|
|
11464
|
+
});
|
|
11465
|
+
|
|
11112
11466
|
// src/compiler/template-reads.ts
|
|
11113
11467
|
function binders(node) {
|
|
11114
11468
|
switch (node.kind) {
|
|
@@ -11491,6 +11845,18 @@ var init_own_markup = __esm(() => {
|
|
|
11491
11845
|
TEXT_ATTRIBUTE = /\bwith\s*\{\s*type\s*:\s*(['"])text\1/;
|
|
11492
11846
|
});
|
|
11493
11847
|
|
|
11848
|
+
// src/compiler/rest-omits.ts
|
|
11849
|
+
function restOmits(props, written, facts) {
|
|
11850
|
+
const owned = facts.parts?.merges === true;
|
|
11851
|
+
const declared = props.bindings.filter((binding) => written?.has(binding.key) ?? true);
|
|
11852
|
+
return [
|
|
11853
|
+
...declared.map((binding) => JSON.stringify(binding.key)),
|
|
11854
|
+
...owned ? ['"class"', '"parts"'] : [],
|
|
11855
|
+
...owned && facts.recipe !== undefined ? [`...${facts.recipe}.variants`] : [],
|
|
11856
|
+
...owned ? Object.keys(facts.ui?.variants ?? {}).map((name) => JSON.stringify(name)) : []
|
|
11857
|
+
];
|
|
11858
|
+
}
|
|
11859
|
+
|
|
11494
11860
|
// src/compiler/slot-types.ts
|
|
11495
11861
|
function slotBlocks(file) {
|
|
11496
11862
|
const blocks = new Map;
|
|
@@ -11687,7 +12053,8 @@ const ${VALUES} = { ${[...this.options.values].map(([name, value]) => `${name}:
|
|
|
11687
12053
|
else if (head && this.kind === "island")
|
|
11688
12054
|
this.emitIslandTitle(head);
|
|
11689
12055
|
this.b.add(`
|
|
11690
|
-
|
|
12056
|
+
${this.mode === "dom" && this.facts.ambientForm ? `const KayHere = ${helperName("formHere")}()
|
|
12057
|
+
` : ""}return `);
|
|
11691
12058
|
this.template(template, errors);
|
|
11692
12059
|
this.exports();
|
|
11693
12060
|
return { builder: this.b, sites: this.sites };
|
|
@@ -11713,7 +12080,7 @@ return `);
|
|
|
11713
12080
|
if (server)
|
|
11714
12081
|
b.add(`import type { ${this.pageContextType()} as KayPageContext, PageData as KayPageData${this.guardValues() !== undefined ? ", GuardValues as KayGuardValues" : ""}${this.declaresQuery() !== undefined ? ", QueryOf as KayQueryOf" : ""}${this.settingType(PRERENDER) !== undefined ? ", PrerenderedContext as KayPrerenderedContext" : ""}${mode === "check" && server.page ? ", PageSettings as KayPageSettings" : ""}${this.actionsTyped ? ", ActionFor as KayActionFor" : ""} } from 'kay'
|
|
11715
12082
|
`);
|
|
11716
|
-
const kayHelpers = [...facts.actionForm ? ["formAction"] : [], ...ambientHelpers(facts)];
|
|
12083
|
+
const kayHelpers = [...facts.actionForm ? ["formAction"] : [], ...ambientHelpers(facts, mode)];
|
|
11717
12084
|
if (this.rootBlocks().length > 0)
|
|
11718
12085
|
kayHelpers.push("fill");
|
|
11719
12086
|
const actions = server?.exportNames.filter((name) => !NOT_ACTIONS.has(name)) ?? [];
|
|
@@ -11747,12 +12114,12 @@ return `);
|
|
|
11747
12114
|
}
|
|
11748
12115
|
b.add(this.slotTypes().imports);
|
|
11749
12116
|
if (mode === "html")
|
|
11750
|
-
b.add(htmlHelperImport(this.options.awaitAlert, facts.await));
|
|
12117
|
+
b.add(htmlHelperImport(this.options.awaitAlert, facts.await) + lazyNoteImport(this.options.lazy, mode));
|
|
11751
12118
|
if (this.loadPlan)
|
|
11752
12119
|
b.add(`import { loadScope as ${helperName("loadScope")} } from 'kay/html'
|
|
11753
12120
|
`);
|
|
11754
12121
|
if (mode === "dom")
|
|
11755
|
-
b.add(domHelperImport(this.options.awaitAlert, facts.await));
|
|
12122
|
+
b.add(domHelperImport(this.options.awaitAlert, facts.await) + lazyDomImport(this.options.lazy));
|
|
11756
12123
|
if (mode === "dom" && this.kind === "island" && titled)
|
|
11757
12124
|
b.add(`import { pageTitle as ${helperName("pageTitle")} } from 'kay/internal/title'
|
|
11758
12125
|
`);
|
|
@@ -11991,7 +12358,7 @@ export default KayIsland(${JSON.stringify(this.options.island)}, ${name}${this.g
|
|
|
11991
12358
|
const left = duplicates.filter(inside);
|
|
11992
12359
|
if (left.length > 0 && left.length === imports.filter(inside).length)
|
|
11993
12360
|
return;
|
|
11994
|
-
const edits = left.map((binding) => this.
|
|
12361
|
+
const edits = [...left.map((binding) => withoutComma(this.src, binding.span, binding.declaration)), ...lazyEdits(imports, span, this.options.lazy, this.mode, this.options.moduleId)];
|
|
11995
12362
|
for (const specifier of specifiers) {
|
|
11996
12363
|
const quoted = this.src.slice(specifier.start, specifier.end);
|
|
11997
12364
|
const target = specifier.start >= span.start && specifier.end <= span.end ? this.options.relocateImport?.(quoted.length > 1 && quoted.endsWith(quoted[0]) ? quoted.slice(1, -1) : quoted.slice(1)) : undefined;
|
|
@@ -12016,13 +12383,6 @@ export default KayIsland(${JSON.stringify(this.options.island)}, ${name}${this.g
|
|
|
12016
12383
|
return start === 0 || this.src[start - 1] === `
|
|
12017
12384
|
` ? start : offset;
|
|
12018
12385
|
}
|
|
12019
|
-
withoutComma(specifier, declaration) {
|
|
12020
|
-
const after = IMPORT_COMMA_AFTER.exec(this.src.slice(specifier.end, declaration.end));
|
|
12021
|
-
if (after)
|
|
12022
|
-
return { start: specifier.start, end: specifier.end + after[0].length };
|
|
12023
|
-
const before = IMPORT_COMMA_BEFORE.exec(this.src.slice(declaration.start, specifier.start));
|
|
12024
|
-
return { start: specifier.start - (before?.[0].length ?? 0), end: specifier.end };
|
|
12025
|
-
}
|
|
12026
12386
|
emitLoad(server) {
|
|
12027
12387
|
const { b } = this;
|
|
12028
12388
|
const query = this.declaresQuery();
|
|
@@ -12143,9 +12503,7 @@ const { `);
|
|
|
12143
12503
|
`);
|
|
12144
12504
|
}
|
|
12145
12505
|
if (props.rest) {
|
|
12146
|
-
const
|
|
12147
|
-
const keys = [...props.bindings.map((binding) => JSON.stringify(binding.key)), ...owned ? ['"class"', '"parts"'] : [], ...owned && this.facts.recipe !== undefined ? [`...${this.facts.recipe}.variants`] : [], ...owned ? Object.keys(this.facts.ui?.variants ?? {}).map((name) => JSON.stringify(name)) : []];
|
|
12148
|
-
b.add("const ").addSource(props.rest).add(` = ${helperName("omit")}(${PROPS}, ${keys.join(", ")});
|
|
12506
|
+
b.add("const ").addSource(props.rest).add(` = ${helperName("omit")}(${PROPS}, ${restOmits(props, this.options.writtenProps, this.facts).join(", ")});
|
|
12149
12507
|
`);
|
|
12150
12508
|
}
|
|
12151
12509
|
if (!this.options.rewrites && props.bindings.length > 0) {
|
|
@@ -12293,17 +12651,19 @@ function deferredData(facts, server) {
|
|
|
12293
12651
|
function paramsType(options) {
|
|
12294
12652
|
return options.params ? `{ ${options.params.map((name) => `${JSON.stringify(name)}: ${options.paramTypes?.[name] ?? "string"}`).join(", ")} }` : "Record<string, string>";
|
|
12295
12653
|
}
|
|
12296
|
-
var HORIZONTAL_SPACE, WRITE_NAMES, CTX_REFERENCE, IDENTIFIER6,
|
|
12654
|
+
var HORIZONTAL_SPACE, WRITE_NAMES, CTX_REFERENCE, IDENTIFIER6, BROKEN_SPECIFIER, PRERENDER = "prerender", QUERY2 = "query", NOT_ACTIONS;
|
|
12297
12655
|
var init_codegen = __esm(() => {
|
|
12298
12656
|
init_action();
|
|
12299
12657
|
init_ast();
|
|
12300
12658
|
init_dom();
|
|
12301
12659
|
init_head_shorthand();
|
|
12302
12660
|
init_html();
|
|
12661
|
+
init_import_edits();
|
|
12303
12662
|
init_inspect();
|
|
12304
12663
|
init_island_arguments();
|
|
12305
12664
|
init_items();
|
|
12306
12665
|
init_jsx();
|
|
12666
|
+
init_lazy_imports();
|
|
12307
12667
|
init_load_plan();
|
|
12308
12668
|
init_mapping();
|
|
12309
12669
|
init_markup();
|
|
@@ -12320,8 +12680,6 @@ var init_codegen = __esm(() => {
|
|
|
12320
12680
|
WRITE_NAMES = { to: "writeTo", update: "updateTo", back: "writeBack", updateBack: "updateBack" };
|
|
12321
12681
|
CTX_REFERENCE = /\bctx\b/;
|
|
12322
12682
|
IDENTIFIER6 = /[\p{ID_Start}$_][\p{ID_Continue}$]*/gu;
|
|
12323
|
-
IMPORT_COMMA_AFTER = /^\s*,\s*/;
|
|
12324
|
-
IMPORT_COMMA_BEFORE = /,\s*$/;
|
|
12325
12683
|
BROKEN_SPECIFIER = /^((?:\s*(?:\/\/.*\n|\/\*(?:[^*]|\*(?!\/))*\*\/))*\s*import\b(?:[^'"]*[^\w$'"]from)?\s*)((['"])[^'";\s]*\3?)/;
|
|
12326
12684
|
NOT_ACTIONS = new Set([PAGE, ...PAGE_SETTINGS]);
|
|
12327
12685
|
});
|
|
@@ -12563,27 +12921,32 @@ var init_deprecated_parts = __esm(() => {
|
|
|
12563
12921
|
init_old_parts();
|
|
12564
12922
|
});
|
|
12565
12923
|
|
|
12566
|
-
// src/
|
|
12567
|
-
function
|
|
12568
|
-
|
|
12569
|
-
|
|
12570
|
-
|
|
12571
|
-
|
|
12572
|
-
|
|
12573
|
-
|
|
12574
|
-
|
|
12575
|
-
|
|
12576
|
-
|
|
12577
|
-
|
|
12578
|
-
|
|
12579
|
-
|
|
12580
|
-
|
|
12581
|
-
|
|
12582
|
-
|
|
12583
|
-
|
|
12584
|
-
|
|
12585
|
-
|
|
12586
|
-
|
|
12924
|
+
// src/runtime/form-types.ts
|
|
12925
|
+
function autocompleteByName(name) {
|
|
12926
|
+
return NAMED_AUTOCOMPLETE.get(name.replace(NAME_SEPARATORS, "").toLowerCase());
|
|
12927
|
+
}
|
|
12928
|
+
var NAMED_AUTOCOMPLETE, NAME_SEPARATORS;
|
|
12929
|
+
var init_form_types = __esm(() => {
|
|
12930
|
+
NAMED_AUTOCOMPLETE = new Map([
|
|
12931
|
+
["firstname", "given-name"],
|
|
12932
|
+
["givenname", "given-name"],
|
|
12933
|
+
["lastname", "family-name"],
|
|
12934
|
+
["familyname", "family-name"],
|
|
12935
|
+
["surname", "family-name"],
|
|
12936
|
+
["username", "username"],
|
|
12937
|
+
["email", "email"],
|
|
12938
|
+
["phone", "tel"],
|
|
12939
|
+
["tel", "tel"],
|
|
12940
|
+
["telephone", "tel"],
|
|
12941
|
+
["zip", "postal-code"],
|
|
12942
|
+
["postalcode", "postal-code"],
|
|
12943
|
+
["postcode", "postal-code"],
|
|
12944
|
+
["currentpassword", "current-password"],
|
|
12945
|
+
["newpassword", "new-password"],
|
|
12946
|
+
["otp", "one-time-code"],
|
|
12947
|
+
["birthday", "bday"]
|
|
12948
|
+
]);
|
|
12949
|
+
NAME_SEPARATORS = /[\s_-]+/g;
|
|
12587
12950
|
});
|
|
12588
12951
|
|
|
12589
12952
|
// src/runtime/form.ts
|
|
@@ -13152,6 +13515,9 @@ h2 Pricing`
|
|
|
13152
13515
|
});
|
|
13153
13516
|
|
|
13154
13517
|
// src/compiler/a11y.ts
|
|
13518
|
+
function givesAutocomplete(written, field, type) {
|
|
13519
|
+
return written || field !== undefined && (type === "email" || autocompleteByName(field) !== undefined);
|
|
13520
|
+
}
|
|
13155
13521
|
function maskLiterals(code) {
|
|
13156
13522
|
const blank = (part) => part.replace(NOT_LINE_BREAK, " ");
|
|
13157
13523
|
const holes = [];
|
|
@@ -13465,7 +13831,7 @@ import Tooltip from '@kayjs/ui/tooltip.kay'` });
|
|
|
13465
13831
|
if (pointer && !answers.some((name) => has(element, name)))
|
|
13466
13832
|
lint(pointer.name, "mouse-only-event", `\`${text(pointer.name)}\` has no keyboard counterpart on this \`${element.name}\``, { note: "what the pointer reveals or hides is never reached by a keyboard user, whom only focus tells", help: `handle \`${wanted}\` the same way, on an element the keyboard reaches` });
|
|
13467
13833
|
}
|
|
13468
|
-
if (element.name === "input" && type !== undefined && FILLED_TYPES.has(type) && !has(element, "autocomplete"))
|
|
13834
|
+
if (element.name === "input" && type !== undefined && FILLED_TYPES.has(type) && !givesAutocomplete(has(element, "autocomplete"), staticValue(element, "field"), type))
|
|
13469
13835
|
lint(element, "missing-autocomplete", `This \`${type}\` input has no \`autocomplete\``, { note: "a browser or a password manager fills a field from it, which people with motor or memory difficulties rely on", help: type === "email" ? 'write `autocomplete="email"`, or `username`' : 'write `autocomplete="current-password"` or `new-password`' });
|
|
13470
13836
|
const autocomplete = staticValue(element, "autocomplete");
|
|
13471
13837
|
if (autocomplete !== undefined && (element.name === "form" ? !["on", "off"].includes(autocomplete.trim().toLowerCase()) : LABELLED.has(element.name) && !validAutocomplete(autocomplete)))
|
|
@@ -13618,6 +13984,7 @@ function exclusive(a, b) {
|
|
|
13618
13984
|
}
|
|
13619
13985
|
var LABELLED, UNLABELLED_TYPES, NAMING2, HEADING2, UI_IMPORT, TOOLTIP_IMPORT, WHITESPACE_CHAR2, TOOLTIP_NAME, FOCUSABLE, INTERACTIVE, REDUNDANT_ALT, FILENAME_ALT, WHITESPACE15, NOT_LINE_BREAK, DESCRIBING, ROLELESS, UNNAMEABLE, REFERENCES, NAMED_ROLES, GROUP_ROLES, REFRESH_DELAY, FILLED_TYPES, POINTER_IN, FOCUS_IN, POINTER_OUT, FOCUS_OUT, WALKS;
|
|
13620
13986
|
var init_a11y = __esm(() => {
|
|
13987
|
+
init_form_types();
|
|
13621
13988
|
init_a11y_markup();
|
|
13622
13989
|
init_aria();
|
|
13623
13990
|
init_ast();
|
|
@@ -13677,11 +14044,10 @@ export async function members(auth: Auth, org: string) {
|
|
|
13677
14044
|
};
|
|
13678
14045
|
});
|
|
13679
14046
|
|
|
13680
|
-
// src/compiler/deprecated-lints.ts
|
|
13681
|
-
var
|
|
13682
|
-
var
|
|
13683
|
-
|
|
13684
|
-
DEPRECATED_LINTS = {
|
|
14047
|
+
// src/compiler/deprecated-lints-1-105.ts
|
|
14048
|
+
var SOURCE_READERS;
|
|
14049
|
+
var init_deprecated_lints_1_105 = __esm(() => {
|
|
14050
|
+
SOURCE_READERS = {
|
|
13685
14051
|
"deprecated-source-readers": {
|
|
13686
14052
|
level: "warn",
|
|
13687
14053
|
group: "deprecated",
|
|
@@ -13767,7 +14133,145 @@ form(action={add})
|
|
|
13767
14133
|
input(name="title" aria-invalid={add.form.error('title') ? 'true' : undefined})
|
|
13768
14134
|
if add.form.failed()
|
|
13769
14135
|
p Not saved`
|
|
14136
|
+
}
|
|
14137
|
+
};
|
|
14138
|
+
});
|
|
14139
|
+
|
|
14140
|
+
// src/compiler/deprecated-lints-1-106.ts
|
|
14141
|
+
var SCHEMA_BUILDERS;
|
|
14142
|
+
var init_deprecated_lints_1_106 = __esm(() => {
|
|
14143
|
+
SCHEMA_BUILDERS = {
|
|
14144
|
+
"deprecated-schema-builders": {
|
|
14145
|
+
level: "warn",
|
|
14146
|
+
group: "deprecated",
|
|
14147
|
+
since: "1.106",
|
|
14148
|
+
site: true,
|
|
14149
|
+
summary: "The PascalCase builders of `s` before 1.106, which kay's own lowercase builders replace, each taking the same field options (`optional`, `default`, `error`, `label`, `description`, `example`) and short names for the rest: `s.String` is `s.string` (`min`, `max`), `s.Integer` `s.int`, `s.Number` and `s.Numeric` `s.number`, `s.Boolean` and `s.BooleanString` `s.boolean`, `s.Array` `s.list`, `s.UnionEnum` and `s.UnionKeys` `s.enum`, and `s.Date`, `s.Literal`, `s.Union`, `s.Object`, `s.File`, `s.Files`, `s.Secret` and `s.Public` their lowercase names; `s.Optional(field)` is `optional: true` in the options of the field; an `s.Object({ ... })` that is the schema of an `action` or a `defineEnv` is the record of fields alone; and a file size written `'2m'` is `'2mb'`. The old names work until 2.0. Found on the `s` a file imports from `kay`, in the TypeScript files and the fences of `.kay` files. The fix renames the builder and the options that changed; an `s.Optional` around anything but one of these builders, such as a helper of `kay/content`, is left as it is. A lowercase `s.object` refuses a key its shape lacks where kay reads the schema itself (an action's input, an API route's body, `defineEnv`, collection frontmatter), where `s.Object` let it by: write `{ extra: 'strip' }` where the old way is wanted. A query, the headers and the cookies of a request carry keys no schema names, so their unknown keys are dropped whatever the schema says.",
|
|
14150
|
+
wrong: `--- server
|
|
14151
|
+
import { action, s } from 'kay'
|
|
14152
|
+
|
|
14153
|
+
export const add = action(s.Object({ title: s.String({ maxLength: 200 }), note: s.Optional(s.String()) }), ({ title }) => title)
|
|
14154
|
+
---
|
|
14155
|
+
p x`,
|
|
14156
|
+
right: `--- server
|
|
14157
|
+
import { action, s } from 'kay'
|
|
14158
|
+
|
|
14159
|
+
export const add = action({ title: s.string({ max: 200 }), note: s.string({ optional: true }) }, ({ title }) => title)
|
|
14160
|
+
---
|
|
14161
|
+
p x`
|
|
14162
|
+
}
|
|
14163
|
+
};
|
|
14164
|
+
});
|
|
14165
|
+
|
|
14166
|
+
// src/compiler/deprecated-lints-1-107.ts
|
|
14167
|
+
var ACTION_OPTIONS;
|
|
14168
|
+
var init_deprecated_lints_1_107 = __esm(() => {
|
|
14169
|
+
ACTION_OPTIONS = {
|
|
14170
|
+
"deprecated-action-options": {
|
|
14171
|
+
level: "warn",
|
|
14172
|
+
group: "deprecated",
|
|
14173
|
+
since: "1.107",
|
|
14174
|
+
site: true,
|
|
14175
|
+
summary: "The arguments of `action` before 1.107, `action(schema, handler, options)` and `action(handler, options)`: the options come first, with the input in them, as an API route's do, `action({ input: schema, ...options }, handler)` and `action(options, handler)`. `input` is a plain record of fields or any schema. The old forms work until 2.0. Found on the `action` a file imports from `kay`, in the TypeScript files and the fences of `.kay` files; the fix moves the arguments and keeps their text.",
|
|
14176
|
+
wrong: `--- server
|
|
14177
|
+
import { action, s } from 'kay'
|
|
14178
|
+
|
|
14179
|
+
export const add = action({ title: s.string() }, ({ title }) => title, { maxSize: '1mb' })
|
|
14180
|
+
---
|
|
14181
|
+
p x`,
|
|
14182
|
+
right: `--- server
|
|
14183
|
+
import { action, s } from 'kay'
|
|
14184
|
+
|
|
14185
|
+
export const add = action({ input: { title: s.string() }, maxSize: '1mb' }, ({ title }) => title)
|
|
14186
|
+
---
|
|
14187
|
+
p x`
|
|
14188
|
+
}
|
|
14189
|
+
};
|
|
14190
|
+
});
|
|
14191
|
+
|
|
14192
|
+
// src/compiler/deprecated-typed-lints.ts
|
|
14193
|
+
var TYPED_DEPRECATIONS;
|
|
14194
|
+
var init_deprecated_typed_lints = __esm(() => {
|
|
14195
|
+
TYPED_DEPRECATIONS = {
|
|
14196
|
+
"deprecated-callback-handler": {
|
|
14197
|
+
level: "deny",
|
|
14198
|
+
group: "deprecated",
|
|
14199
|
+
since: "1.105",
|
|
14200
|
+
typed: true,
|
|
14201
|
+
summary: "A function written for the arguments a kayjs-ui, kayjs-ai or kayjs-cms callback took before 1.105, given to a callback that takes one event object since: `onValueChange={query.set}`, `onCheckedChange={toggle}` with `toggle(on: boolean)` or `onFiles={upload}` with `upload(files: File[])`. Found where the type check refuses the function and the component comes from a `@kayjs` library; the fix writes `event => query.set(event.value)`, passing the fields the handler took, first ones first, and is applied where its parameter is no object (a parameter typed as an object may be written for the event already, so that fix is offered). A handler that is not a plain name, such as an arrow function, is reported with no fix. The old form fails the type check, and would receive the event where it took the value, so the level is `deny` until it is rewritten.",
|
|
14202
|
+
wrong: `---
|
|
14203
|
+
import { signal } from 'kay'
|
|
14204
|
+
import Checkbox from '@kayjs/ui/checkbox.kay'
|
|
14205
|
+
|
|
14206
|
+
const on = signal(false)
|
|
14207
|
+
|
|
14208
|
+
function toggle(next: boolean) {
|
|
14209
|
+
on.set(next)
|
|
14210
|
+
}
|
|
14211
|
+
---
|
|
14212
|
+
Checkbox(label="Notify" checked={on()} onChange={toggle})`,
|
|
14213
|
+
right: `---
|
|
14214
|
+
import { signal } from 'kay'
|
|
14215
|
+
import Checkbox from '@kayjs/ui/checkbox.kay'
|
|
14216
|
+
|
|
14217
|
+
const on = signal(false)
|
|
14218
|
+
|
|
14219
|
+
function toggle(next: boolean) {
|
|
14220
|
+
on.set(next)
|
|
14221
|
+
}
|
|
14222
|
+
---
|
|
14223
|
+
Checkbox(label="Notify" checked={on()} onChange={event => toggle(event.checked)})`
|
|
13770
14224
|
},
|
|
14225
|
+
"deprecated-call-result": {
|
|
14226
|
+
level: "deny",
|
|
14227
|
+
group: "deprecated",
|
|
14228
|
+
since: "1.105",
|
|
14229
|
+
typed: true,
|
|
14230
|
+
summary: "An island's call read as its data, `const list = await call(notes, '/')` then `list.items`, or `await add(input)` then `.id`, which resolved with the data before 1.105 and answers a `CallResult`, `{ ok: true, data }` or `{ ok: false, error }`, since. Found where the type check refuses a field of a `CallResult`, in a `.kay` script or a module. The fix writes `.orThrow()` after the call, which resolves with the data and throws a refusal as the call did; it is applied where the call is written on an imported name and nothing reads `ok`, `data` or `error` of the answer, and offered otherwise. The old form fails the type check, so the level is `deny`.",
|
|
14231
|
+
wrong: `---
|
|
14232
|
+
import { call, signal } from 'kay'
|
|
14233
|
+
import notes from '../api/notes'
|
|
14234
|
+
|
|
14235
|
+
const names = signal('')
|
|
14236
|
+
|
|
14237
|
+
async function load() {
|
|
14238
|
+
const list = await call(notes, '/')
|
|
14239
|
+
|
|
14240
|
+
names = list.items.join(', ')
|
|
14241
|
+
}
|
|
14242
|
+
---
|
|
14243
|
+
button(onClick={load}) Load
|
|
14244
|
+
p {names()}`,
|
|
14245
|
+
right: `---
|
|
14246
|
+
import { call, signal } from 'kay'
|
|
14247
|
+
import notes from '../api/notes'
|
|
14248
|
+
|
|
14249
|
+
const names = signal('')
|
|
14250
|
+
|
|
14251
|
+
async function load() {
|
|
14252
|
+
const list = await call(notes, '/').orThrow()
|
|
14253
|
+
|
|
14254
|
+
names = list.items.join(', ')
|
|
14255
|
+
}
|
|
14256
|
+
---
|
|
14257
|
+
button(onClick={load}) Load
|
|
14258
|
+
p {names()}`
|
|
14259
|
+
}
|
|
14260
|
+
};
|
|
14261
|
+
});
|
|
14262
|
+
|
|
14263
|
+
// src/compiler/deprecated-lints.ts
|
|
14264
|
+
var DEPRECATED_LINTS;
|
|
14265
|
+
var init_deprecated_lints = __esm(() => {
|
|
14266
|
+
init_deprecated_auth_lints();
|
|
14267
|
+
init_deprecated_lints_1_105();
|
|
14268
|
+
init_deprecated_lints_1_106();
|
|
14269
|
+
init_deprecated_lints_1_107();
|
|
14270
|
+
init_deprecated_typed_lints();
|
|
14271
|
+
DEPRECATED_LINTS = {
|
|
14272
|
+
...SCHEMA_BUILDERS,
|
|
14273
|
+
...ACTION_OPTIONS,
|
|
14274
|
+
...SOURCE_READERS,
|
|
13771
14275
|
"deprecated-ui-props": {
|
|
13772
14276
|
level: "warn",
|
|
13773
14277
|
group: "deprecated",
|
|
@@ -13806,50 +14310,13 @@ Card(class={{ head: 'p-6' }})`,
|
|
|
13806
14310
|
import Card from './card.kay'
|
|
13807
14311
|
---
|
|
13808
14312
|
Card(parts={{ head: 'p-6' }})`
|
|
13809
|
-
},
|
|
13810
|
-
"deprecated-script-fence": {
|
|
13811
|
-
level: "warn",
|
|
13812
|
-
group: "deprecated",
|
|
13813
|
-
since: "1.102",
|
|
13814
|
-
summary: "`--- script` as the first fence of a file, `---` since 1.102: the bare line opens the component script wherever no named fence comes before it, so one fence had two spellings. `--- script` stays for a script that follows a `--- server`, `--- module` or `--- style` fence, where a bare `---` would close that fence instead, and `--- client` still replaces `---` rather than modifying it. The old form still works. The fix drops the word, keeping the type parameters of `--- script <T>` as `--- <T>`.",
|
|
13815
|
-
wrong: `--- script
|
|
13816
|
-
const { title } = props<{ title: string }>()
|
|
13817
|
-
---
|
|
13818
|
-
h1 {title}`,
|
|
13819
|
-
right: `---
|
|
13820
|
-
const { title } = props<{ title: string }>()
|
|
13821
|
-
---
|
|
13822
|
-
h1 {title}`
|
|
13823
|
-
},
|
|
13824
|
-
"deprecated-schema-type": {
|
|
13825
|
-
level: "warn",
|
|
13826
|
-
group: "deprecated",
|
|
13827
|
-
since: "1.103",
|
|
13828
|
-
site: true,
|
|
13829
|
-
summary: "`TSchema` imported from `kay/library`, `Schema` since 1.103: kay's own name for what `s` builds and every schema option takes, so a signature of the app does not name TypeBox, whose type follows the Elysia kay is built on. The old name works until 1.106. Found on an import from `kay/library` in the TypeScript files and `.kay` files of the project. The fix renames the import and each use of it; a file that already has a `Schema` of its own is reported with no fix, and one that imports it aliased with only the import renamed.",
|
|
13830
|
-
wrong: `---
|
|
13831
|
-
import type { TSchema } from 'kay/library'
|
|
13832
|
-
|
|
13833
|
-
export function check<Fields extends TSchema>(fields: Fields) {
|
|
13834
|
-
return fields
|
|
13835
|
-
}
|
|
13836
|
-
---
|
|
13837
|
-
p x`,
|
|
13838
|
-
right: `---
|
|
13839
|
-
import type { Schema } from 'kay/library'
|
|
13840
|
-
|
|
13841
|
-
export function check<Fields extends Schema>(fields: Fields) {
|
|
13842
|
-
return fields
|
|
13843
|
-
}
|
|
13844
|
-
---
|
|
13845
|
-
p x`
|
|
13846
14313
|
},
|
|
13847
14314
|
"deprecated-package-names": {
|
|
13848
14315
|
level: "warn",
|
|
13849
14316
|
group: "deprecated",
|
|
13850
14317
|
since: "1.104",
|
|
13851
14318
|
site: true,
|
|
13852
|
-
summary: "A package of kay under the `@kaynooo` scope, `@kayjs` since 1.104: `@kaynooo/kayjs` is `@kayjs/kay`, and `@kaynooo/kayjs-ui`, `-auth`, `-mail`, `-cms` and `-ai` are `@kayjs/ui`, `@kayjs/auth`, `@kayjs/mail`, `@kayjs/cms` and `@kayjs/ai`. The old names stop at 1.103, which stays installable, so an app on them installs and checks as before until it moves; this lint goes in 1.107. Found
|
|
14319
|
+
summary: "A package of kay under the `@kaynooo` scope, `@kayjs` since 1.104: `@kaynooo/kayjs` is `@kayjs/kay`, and `@kaynooo/kayjs-ui`, `-auth`, `-mail`, `-cms` and `-ai` are `@kayjs/ui`, `@kayjs/auth`, `@kayjs/mail`, `@kayjs/cms` and `@kayjs/ai`. The old names stop at 1.103, which stays installable, so an app on them installs and checks as before until it moves; this lint goes in 1.107. Found where a name is an `import` or `export ... from` specifier, a `require()`, `import()` or `mock.module()` argument or a config key (a quoted name keyed to anything but a package name or a version, as `librarySettings`) of the project's TypeScript and `.kay` files, in the `@import` and `@plugin` paths of its CSS, and in its package.json and tsconfig files; a name in a comment or any other string, as data a tool reads or a table of renames, is left alone. The fix writes the new name; a package.json that lists the new name already is reported with a fix that is not safe, and `kay upgrade` does the whole move, package.json and install included.",
|
|
13853
14320
|
wrong: `---
|
|
13854
14321
|
import Button from '@kaynooo/kayjs-ui/button.kay'
|
|
13855
14322
|
---
|
|
@@ -13933,7 +14400,7 @@ Card(server defer)`
|
|
|
13933
14400
|
level: "warn",
|
|
13934
14401
|
group: "deprecated",
|
|
13935
14402
|
since: "1.105",
|
|
13936
|
-
summary: '`data-keep-scroll`, `data-no-transition` and `data-no-prefetch`, named as the options of `navigate()` since 1.105: `data-scroll="keep"` (`"top"` for a plain scroll), `data-transition="false"` and `data-prefetch="false"`, typed on every element. The old names work until 1.108. Found on any element and on a component call that forwards them to its link. The fix writes the new attribute, a static `data-keep-scroll="false"` becoming `data-scroll="top"` and a dynamic `data-keep-scroll` being renamed with its value; a dynamic `data-no-transition` or `data-no-prefetch` is reported with no fix, as the old name was set by being present.',
|
|
14403
|
+
summary: '`data-keep-scroll`, `data-no-transition` and `data-no-prefetch`, named as the options of `navigate()` since 1.105: `data-scroll="keep"` (`"top"` for a plain scroll), `data-transition="false"` and `data-prefetch="false"`, typed on every element. The old names work until 1.108. Found on any element and on a component call that forwards them to its link. The fix writes the new attribute, a static `data-keep-scroll="false"` becoming `data-scroll="top"` and a dynamic `data-keep-scroll` being renamed with its value; a dynamic `data-no-transition` or `data-no-prefetch` is reported with no fix, as the old name was set by being present. The app\'s test files (`*.test.*`, `*.spec.*`) are checked too: a selector `[data-keep-scroll]` is written `[data-scroll=keep]` by the fix, an attribute read by name (`getAttribute(\'data-keep-scroll\')`) has a fix that is not safe, a read of `dataset.keepScroll` (and `noTransition`, `noPrefetch`) has one too, and a write of it and any other string naming an old flag have none.',
|
|
13937
14404
|
wrong: `nav(data-keep-scroll)
|
|
13938
14405
|
a(href="/tabs/a" data-no-prefetch) A`,
|
|
13939
14406
|
right: `nav(data-scroll="keep")
|
|
@@ -14049,6 +14516,7 @@ SignedIn(require="admin")
|
|
|
14049
14516
|
a(href="/admin") Admin`
|
|
14050
14517
|
},
|
|
14051
14518
|
...AUTH_LINTS,
|
|
14519
|
+
...TYPED_DEPRECATIONS,
|
|
14052
14520
|
"deprecated-ui-callbacks": {
|
|
14053
14521
|
level: "warn",
|
|
14054
14522
|
group: "deprecated",
|
|
@@ -14459,7 +14927,7 @@ export default { client: { search: true, offline: true } }`
|
|
|
14459
14927
|
group: "deprecated",
|
|
14460
14928
|
since: "1.105",
|
|
14461
14929
|
site: true,
|
|
14462
|
-
summary: "The keys `images`, `fonts`, `favicon`, `manifest` and `publicCache` of kay.config.ts, written in `assets` since 1.105, and `observe`, `health`, `metrics` and `jobs`, written in `ops`: `assets: { images, fonts, favicon, manifest, publicCache }`, `ops: { observe, health, metrics, jobs }`. They work until 1.108. Found in the object kay.config.ts exports
|
|
14930
|
+
summary: "The keys `images`, `fonts`, `favicon`, `manifest` and `publicCache` of kay.config.ts, written in `assets` since 1.105, and `observe`, `health`, `metrics` and `jobs`, written in `ops`: `assets: { images, fonts, favicon, manifest, publicCache }`, `ops: { observe, health, metrics, jobs }`. They work until 1.108. Found in the object kay.config.ts exports, in the `config` of `pages()` and `testSite()` and in the `config` of an extension a file types `KayExtension`, which takes the same keys. The fix moves the keys into their group as written, unless the object spreads, holds a computed key or has the group already.",
|
|
14463
14931
|
wrong: `// kay.config.ts
|
|
14464
14932
|
export default { images: { widths: [640] }, health: false }`,
|
|
14465
14933
|
right: `// kay.config.ts
|
|
@@ -14492,7 +14960,7 @@ export default { endpoints: { mcp: '/tools', health: '/up' }, mcp: {}, health: {
|
|
|
14492
14960
|
group: "deprecated",
|
|
14493
14961
|
since: "1.105",
|
|
14494
14962
|
site: true,
|
|
14495
|
-
summary: "The secrets of kay.config.ts in one shape since 1.105, each `string | { env } | { file }`: `mcp.key` is `mcp.token`, and `proxy.key`, a header name, is `{ header, secret? }`, so `proxy: { key: { header: 'x-upstream-key' } }`; the `mcpKey` and `proxyKey` options of `testSite()` are the `token` and the `secret` of its `config`. They work until 1.108. Found in the object kay.config.ts exports and in the `config` of `pages()` and `testSite()`. The fix renames `mcp.key` (a `key: false` and an `mcp` that spreads or has a `token` are reported with no fix) and wraps the header of `proxy.key`; the options of `testSite()` are reported with no fix.",
|
|
14963
|
+
summary: "The secrets of kay.config.ts in one shape since 1.105, each `string | { env } | { file }`: `mcp.key` is `mcp.token`, and `proxy.key`, a header name, is `{ header, secret? }`, so `proxy: { key: { header: 'x-upstream-key' } }`; the `mcpKey` and `proxyKey` options of `testSite()` are the `token` and the `secret` of its `config`. They work until 1.108. Found in the object kay.config.ts exports and in the `config` of `pages()` and `testSite()`. The fix renames `mcp.key` (a `key: false` and an `mcp` that spreads or has a `token` are reported with no fix) and wraps the header of `proxy.key`; the options of `testSite()` move into its `config`, `mcpKey` always and `proxyKey` where the app's config names the header, and are reported with no fix beside a `config` already written.",
|
|
14496
14964
|
wrong: `// kay.config.ts
|
|
14497
14965
|
export default { mcp: { key: true }, proxy: { key: 'x-upstream-key' } }`,
|
|
14498
14966
|
right: `// kay.config.ts
|
|
@@ -14624,7 +15092,7 @@ export default guard(async (ctx) => {
|
|
|
14624
15092
|
group: "deprecated",
|
|
14625
15093
|
since: "1.105",
|
|
14626
15094
|
site: true,
|
|
14627
|
-
summary: "`deny(status, 'message', data)` of a guard, a page, an action and an endpoint, `deny(status, { message, errors, data })` since 1.105: a refusal takes one object in every place, as `refuse(status, { message, errors, data })` does, so `errors` puts a message on a field and the text is no longer an argument beside the data. An action answers `deny(status, { data, errors })` as `ctx.fail
|
|
15095
|
+
summary: "`deny(status, 'message', data)` of a guard, a page, an action and an endpoint, `deny(status, { message, errors, data })` since 1.105: a refusal takes one object in every place, as `refuse(status, { message, errors, data })` does, so `errors` puts a message on a field and the text is no longer an argument beside the data. An action answers `deny(status, { message, data, errors })` as `ctx.fail` did, the page again or an `ActionError`, so its text form, which stopped with plain text, becomes the form's message after the fix. The text form works until 1.108. Found on a call of `deny`, bare or read off a name, with a literal status from 400 to 599 and a text second argument, in the TypeScript files and `.kay` files of the project. The fix writes the object, unless a comment sits between the arguments or a `data` is given, which an action answers as a failure, not plain text.",
|
|
14628
15096
|
wrong: `// src/routes/_guard.ts
|
|
14629
15097
|
import { guard } from 'kay'
|
|
14630
15098
|
|
|
@@ -14884,7 +15352,7 @@ function linkFlags(file) {
|
|
|
14884
15352
|
if (at === undefined)
|
|
14885
15353
|
continue;
|
|
14886
15354
|
const name = file.source.slice(at.start, at.end);
|
|
14887
|
-
const old =
|
|
15355
|
+
const old = OLD_LINK_FLAGS[name];
|
|
14888
15356
|
if (old !== undefined) {
|
|
14889
15357
|
found.push(oldFlag(file.source, attribute, at, name, old));
|
|
14890
15358
|
continue;
|
|
@@ -14892,7 +15360,7 @@ function linkFlags(file) {
|
|
|
14892
15360
|
const meant = name.startsWith("data-") && !FLAGS.has(name) ? nearest(name) : undefined;
|
|
14893
15361
|
if (meant === undefined)
|
|
14894
15362
|
continue;
|
|
14895
|
-
const renamed =
|
|
15363
|
+
const renamed = OLD_LINK_FLAGS[meant];
|
|
14896
15364
|
const to = renamed === undefined ? meant : `${renamed.name}="${renamed.value}"`;
|
|
14897
15365
|
const fixes = renamed !== undefined && attribute.kind !== "boolean" ? [] : [{ title: `Write \`${to}\``, safe: false, edits: [{ ...at, text: to }] }];
|
|
14898
15366
|
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 \`${to}\`?`, fixes, checkOnly: true });
|
|
@@ -14909,7 +15377,7 @@ function oldFlag(source, attribute, at, name, old) {
|
|
|
14909
15377
|
const end = attribute.kind === "static" ? attribute.value.end + (`"'`.includes(source[attribute.value.end] ?? "") ? 1 : 0) : at.end;
|
|
14910
15378
|
return { ...base, fixes: [{ title: `Write \`${old.name}="${written}"\``, safe: true, edits: [{ start: at.start, end, text: `${old.name}="${written}"` }] }] };
|
|
14911
15379
|
}
|
|
14912
|
-
var LINK_LINTS, FLAGS,
|
|
15380
|
+
var LINK_LINTS, FLAGS, OLD_LINK_FLAGS, NEARBY;
|
|
14913
15381
|
var init_link_flags = __esm(() => {
|
|
14914
15382
|
init_aria();
|
|
14915
15383
|
init_ast();
|
|
@@ -14923,12 +15391,12 @@ var init_link_flags = __esm(() => {
|
|
|
14923
15391
|
}
|
|
14924
15392
|
};
|
|
14925
15393
|
FLAGS = new Set(["data-scroll", "data-transition", "data-prefetch", "data-reload"]);
|
|
14926
|
-
|
|
15394
|
+
OLD_LINK_FLAGS = {
|
|
14927
15395
|
"data-keep-scroll": { name: "data-scroll", value: "keep", off: "top" },
|
|
14928
15396
|
"data-no-transition": { name: "data-transition", value: "false" },
|
|
14929
15397
|
"data-no-prefetch": { name: "data-prefetch", value: "false" }
|
|
14930
15398
|
};
|
|
14931
|
-
NEARBY = [...FLAGS, ...Object.keys(
|
|
15399
|
+
NEARBY = [...FLAGS, ...Object.keys(OLD_LINK_FLAGS)];
|
|
14932
15400
|
});
|
|
14933
15401
|
|
|
14934
15402
|
// src/compiler/loop-lints.ts
|
|
@@ -14956,6 +15424,32 @@ for row, i of rows() key={i}
|
|
|
14956
15424
|
};
|
|
14957
15425
|
});
|
|
14958
15426
|
|
|
15427
|
+
// src/compiler/schema-lints.ts
|
|
15428
|
+
var SCHEMA_LINTS;
|
|
15429
|
+
var init_schema_lints = __esm(() => {
|
|
15430
|
+
SCHEMA_LINTS = {
|
|
15431
|
+
"schema-without-json-schema": {
|
|
15432
|
+
level: "warn",
|
|
15433
|
+
group: "forms",
|
|
15434
|
+
site: true,
|
|
15435
|
+
summary: "A Standard Schema validator with no `~standard.jsonSchema` where an action's `input` or an API route's `body`, `query`, `params`, `headers` or `cookie` takes a schema: it still validates, but a form shows no constraints, a form or a query is not read as numbers and booleans, and OpenAPI and MCP show an open schema. Read from the source, in `.ts` modules and `.kay` fences: a hand-written object with `~standard` and no `jsonSchema`, and what valibot builds (valibot carries none until `toStandardJsonSchema` from `@valibot/to-json-schema` wraps it), followed through a `const` and a relative import. Zod 4.2+ and ArkType 2.1.28+ carry it.",
|
|
15436
|
+
wrong: `--- server
|
|
15437
|
+
import { action } from 'kay'
|
|
15438
|
+
import * as v from 'valibot'
|
|
15439
|
+
|
|
15440
|
+
export const add = action({ input: v.object({ title: v.string() }) }, ({ title }) => title)
|
|
15441
|
+
---
|
|
15442
|
+
p x`,
|
|
15443
|
+
right: `--- server
|
|
15444
|
+
import { action, s } from 'kay'
|
|
15445
|
+
|
|
15446
|
+
export const add = action({ input: { title: s.string({ max: 200 }) } }, ({ title }) => title)
|
|
15447
|
+
---
|
|
15448
|
+
p x`
|
|
15449
|
+
}
|
|
15450
|
+
};
|
|
15451
|
+
});
|
|
15452
|
+
|
|
14959
15453
|
// src/compiler/serial-awaits.ts
|
|
14960
15454
|
function stepOf(statement) {
|
|
14961
15455
|
if (statement.type !== "VariableDeclaration" || statement.kind !== "const" || statement.declarations.length !== 1)
|
|
@@ -15057,11 +15551,13 @@ var ROUTE_LINTS;
|
|
|
15057
15551
|
var init_route_lints = __esm(() => {
|
|
15058
15552
|
init_link_flags();
|
|
15059
15553
|
init_loop_lints();
|
|
15554
|
+
init_schema_lints();
|
|
15060
15555
|
init_serial_awaits();
|
|
15061
15556
|
ROUTE_LINTS = {
|
|
15062
15557
|
...SERIAL_AWAITS_LINTS,
|
|
15063
15558
|
...LOOP_LINTS,
|
|
15064
15559
|
...LINK_LINTS,
|
|
15560
|
+
...SCHEMA_LINTS,
|
|
15065
15561
|
"text-size-colour": {
|
|
15066
15562
|
level: "warn",
|
|
15067
15563
|
group: "code",
|
|
@@ -16009,14 +16505,14 @@ label
|
|
|
16009
16505
|
wrong: `--- server
|
|
16010
16506
|
import { action, s } from 'kay'
|
|
16011
16507
|
|
|
16012
|
-
export const add = action(s.
|
|
16508
|
+
export const add = action(s.object({ title: s.string() }), async ({ title }) => create(title))
|
|
16013
16509
|
---
|
|
16014
16510
|
form(action={add})
|
|
16015
16511
|
input(name="title")`,
|
|
16016
16512
|
right: `--- server
|
|
16017
16513
|
import { action, s } from 'kay'
|
|
16018
16514
|
|
|
16019
|
-
export const add = action(s.
|
|
16515
|
+
export const add = action(s.object({ title: s.string({ max: 200 }) }), async ({ title }) => create(title))
|
|
16020
16516
|
---
|
|
16021
16517
|
form(action={add})
|
|
16022
16518
|
input(name="title")`
|
|
@@ -16042,14 +16538,14 @@ p {theme.length}`
|
|
|
16042
16538
|
import { ask } from '@kayjs/ai'
|
|
16043
16539
|
import { action, s } from 'kay'
|
|
16044
16540
|
|
|
16045
|
-
export const reply = action(s.
|
|
16541
|
+
export const reply = action(s.object({ messages: s.list(s.string()) }), async ({ messages }) => ask(messages))
|
|
16046
16542
|
---
|
|
16047
16543
|
p x`,
|
|
16048
16544
|
right: `--- server
|
|
16049
16545
|
import { ask } from '@kayjs/ai'
|
|
16050
16546
|
import { action, s } from 'kay'
|
|
16051
16547
|
|
|
16052
|
-
export const reply = action(s.
|
|
16548
|
+
export const reply = action(s.object({ messages: s.list(s.string()) }), ({ messages }) => ask(messages))
|
|
16053
16549
|
---
|
|
16054
16550
|
p x`
|
|
16055
16551
|
},
|
|
@@ -16058,7 +16554,7 @@ p x`
|
|
|
16058
16554
|
group: "code",
|
|
16059
16555
|
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.",
|
|
16060
16556
|
wrong: `--- server
|
|
16061
|
-
export const rename = action(s.
|
|
16557
|
+
export const rename = action(s.object({ name: s.string() }), ({ name }, ctx) => {
|
|
16062
16558
|
if (name === 'admin')
|
|
16063
16559
|
ctx.fail(409, 'That name is taken')
|
|
16064
16560
|
|
|
@@ -16067,7 +16563,7 @@ export const rename = action(s.Object({ name: s.String() }), ({ name }, ctx) =>
|
|
|
16067
16563
|
---
|
|
16068
16564
|
p x`,
|
|
16069
16565
|
right: `--- server
|
|
16070
|
-
export const rename = action(s.
|
|
16566
|
+
export const rename = action(s.object({ name: s.string() }), ({ name }, ctx) => {
|
|
16071
16567
|
if (name === 'admin')
|
|
16072
16568
|
return ctx.fail(409, 'That name is taken')
|
|
16073
16569
|
|
|
@@ -16081,11 +16577,11 @@ p x`
|
|
|
16081
16577
|
group: "forms",
|
|
16082
16578
|
summary: "A call to `password.register`, `password.requestReset`, `magicLink.request` or `password.signIn` on an auth (a receiver named `auth`, or ending in `auth`), with no `captcha` option, while no `captcha: false` is written in the same file or in an `authCore` (`createAuth` before 1.91) call of the project (`kay check` reads every module): kayjs-auth asks a proof of work by default, so such a call answers `{ ok: false, error: 'captcha' }` until the form carries the challenge. Put `input(type=\"hidden\" name=\"captcha\" data-kay-work={await auth.captcha.challenge('register')})` in the form (action `'reset'`, `'magic-link'` or `'sign-in'` for the others), read the field in the action and pass it as `{ captcha: input.captcha }`. Found in `.kay` fences and `.ts` modules alike.",
|
|
16083
16579
|
wrong: `--- server
|
|
16084
|
-
export const reset = action(s.
|
|
16580
|
+
export const reset = action(s.object({ email: s.string() }), ({ email }, ctx) => ctx.locals.auth.password.requestReset(email))
|
|
16085
16581
|
---
|
|
16086
16582
|
p x`,
|
|
16087
16583
|
right: `--- server
|
|
16088
|
-
export const reset = action(s.
|
|
16584
|
+
export const reset = action(s.object({ email: s.string(), captcha: s.string() }), ({ email, captcha }, ctx) => ctx.locals.auth.password.requestReset(email, { captcha }))
|
|
16089
16585
|
---
|
|
16090
16586
|
p x`
|
|
16091
16587
|
},
|
|
@@ -16265,9 +16761,9 @@ a(href="/users" title="Hello {name}") Profile`,
|
|
|
16265
16761
|
site: true,
|
|
16266
16762
|
summary: "With `mcp`, an action that sets `tool` and a `honeypot`, `minTime` or `proofOfWork`, with no `_guard.ts` covering it: an agent calls it without the form those protections ask of a person, so anonymous callers can spam it. A guard, or a `rateLimit` with `tool` alone, keeps it in hand.",
|
|
16267
16763
|
wrong: `// kay.config.ts sets mcp: true
|
|
16268
|
-
export const subscribe = action(s.
|
|
16764
|
+
export const subscribe = action(s.object({ email: s.string() }), save, { tool: true, protect: { honeypot: 'website' } })`,
|
|
16269
16765
|
right: `// src/routes/_guard.ts covers it, or the action keeps tool and drops the honeypot
|
|
16270
|
-
export const subscribe = action(s.
|
|
16766
|
+
export const subscribe = action(s.object({ email: s.string() }), save, { tool: true, protect: { rateLimit: { max: 5, window: '1m' } } })`
|
|
16271
16767
|
},
|
|
16272
16768
|
"external-redirect": {
|
|
16273
16769
|
level: "warn",
|
|
@@ -16404,8 +16900,8 @@ button(onClick={() => open.set(true)}) Log`
|
|
|
16404
16900
|
group: "code",
|
|
16405
16901
|
site: true,
|
|
16406
16902
|
summary: "An API route `.ws()` with a `body` and no `response`, written with an object literal of options and no spread: an island's `socket()` receives its messages as `unknown`, so `last()` and `on()` need a cast. Add `response: chats.response` when it sends through `rooms()`, or a `response` schema; a route only other clients read can allow the lint.",
|
|
16407
|
-
wrong: "export default api().ws('/', { body: s.
|
|
16408
|
-
right: "export default api().ws('/', { body: s.
|
|
16903
|
+
wrong: "export default api().ws('/', { body: s.object({ text: s.string() }), message(ws, { text }) { chats.publish('main', { text }) } })",
|
|
16904
|
+
right: "export default api().ws('/', { body: s.object({ text: s.string() }), response: chats.response, message(ws, { text }) { chats.publish('main', { text }) } })"
|
|
16409
16905
|
},
|
|
16410
16906
|
"unsized-image": {
|
|
16411
16907
|
level: "warn",
|
|
@@ -16839,12 +17335,12 @@ function lineEnd(source, end) {
|
|
|
16839
17335
|
return at !== -1 && source[end + at] === `
|
|
16840
17336
|
` ? end + at + 1 : end;
|
|
16841
17337
|
}
|
|
16842
|
-
function maxLengthEdit(call, options) {
|
|
17338
|
+
function maxLengthEdit(call, options, key) {
|
|
16843
17339
|
if (options === undefined)
|
|
16844
|
-
return { at: call.end - 1, text: `{
|
|
17340
|
+
return { at: call.end - 1, text: `{ ${key}: ${SUGGESTED_MAX_LENGTH} }` };
|
|
16845
17341
|
if (options.type === "ObjectExpression" && options.properties.length === 0)
|
|
16846
|
-
return { at: options.start + 1, text: `
|
|
16847
|
-
return { at: options.properties[0].start, text:
|
|
17342
|
+
return { at: options.start + 1, text: ` ${key}: ${SUGGESTED_MAX_LENGTH} ` };
|
|
17343
|
+
return { at: options.properties[0].start, text: `${key}: ${SUGGESTED_MAX_LENGTH}, ` };
|
|
16848
17344
|
}
|
|
16849
17345
|
function isBoundedPattern(source) {
|
|
16850
17346
|
if (!source.startsWith("^") || !source.endsWith("$") || source.endsWith("\\$"))
|
|
@@ -16881,7 +17377,7 @@ function isShortField(field) {
|
|
|
16881
17377
|
}
|
|
16882
17378
|
function unboundedFields(server) {
|
|
16883
17379
|
const fence = server?.fence;
|
|
16884
|
-
if (!fence?.code.includes("String"))
|
|
17380
|
+
if (!fence?.code.includes("String") && !fence?.code.includes("string"))
|
|
16885
17381
|
return [];
|
|
16886
17382
|
const diagnostics = [];
|
|
16887
17383
|
const optional = optionalParts();
|
|
@@ -16891,17 +17387,18 @@ function unboundedFields(server) {
|
|
|
16891
17387
|
schemaStrings(node.arguments[0], undefined, (call, field) => {
|
|
16892
17388
|
const options = call.arguments[0];
|
|
16893
17389
|
const known = options === undefined || options.type === "ObjectExpression" && options.properties.every((property) => property.type !== "SpreadElement");
|
|
16894
|
-
if (!known || options?.type === "ObjectExpression" && options.properties.some((property) => property.type !== "SpreadElement" && (propertyKey2(property) === "maxLength" || isBoundedByValue(property))) || field === undefined || isSecret(field) || !isShortField(field))
|
|
17390
|
+
if (!known || options?.type === "ObjectExpression" && options.properties.some((property) => property.type !== "SpreadElement" && (propertyKey2(property) === "maxLength" || propertyKey2(property) === "max" || isBoundedByValue(property))) || field === undefined || isSecret(field) || !isShortField(field))
|
|
16895
17391
|
return;
|
|
16896
|
-
const
|
|
17392
|
+
const lowercase = call.callee.type === "MemberExpression" && call.callee.property.type === "Identifier" && call.callee.property.name === "string";
|
|
17393
|
+
const edit = maxLengthEdit(call, options, lowercase ? "max" : "maxLength");
|
|
16897
17394
|
const at = fence.offset + edit.at;
|
|
16898
17395
|
diagnostics.push({
|
|
16899
17396
|
...fence.shift(call.callee),
|
|
16900
17397
|
code: "unbounded-string",
|
|
16901
|
-
message: `The string field ${field} has no maxLength of its own`,
|
|
17398
|
+
message: `The string field ${field} has no ${lowercase ? "max" : "maxLength"} of its own`,
|
|
16902
17399
|
note: "it takes the default bound of 10,000 characters, which is a lot for a value of its kind",
|
|
16903
17400
|
help: "give it a tighter one",
|
|
16904
|
-
fixes: [{ title: `Give it a maxLength of ${SUGGESTED_MAX_LENGTH}`, edits: [{ start: at, end: at, text: edit.text }] }],
|
|
17401
|
+
fixes: [{ title: `Give it a ${lowercase ? "max" : "maxLength"} of ${SUGGESTED_MAX_LENGTH}`, edits: [{ start: at, end: at, text: edit.text }] }],
|
|
16905
17402
|
checkOnly: true
|
|
16906
17403
|
});
|
|
16907
17404
|
});
|
|
@@ -17007,7 +17504,7 @@ function schemaStrings(node, field, found) {
|
|
|
17007
17504
|
eachNode(node, (inner, parent) => {
|
|
17008
17505
|
if (isPlainProperty(inner))
|
|
17009
17506
|
schemaStrings(inner.value, propertyKey2(inner) ?? field, found);
|
|
17010
|
-
else if (!optional(inner, parent) && inner.type === "CallExpression" && inner.callee.type === "MemberExpression" && inner.callee.property.type === "Identifier" && inner.callee.property.name === "String")
|
|
17507
|
+
else if (!optional(inner, parent) && inner.type === "CallExpression" && inner.callee.type === "MemberExpression" && inner.callee.property.type === "Identifier" && (inner.callee.property.name === "String" || inner.callee.property.name === "string"))
|
|
17011
17508
|
found(inner, field);
|
|
17012
17509
|
return !isPlainProperty(inner);
|
|
17013
17510
|
});
|
|
@@ -17360,10 +17857,11 @@ var init_markdown_task = __esm(() => {
|
|
|
17360
17857
|
});
|
|
17361
17858
|
|
|
17362
17859
|
// src/runtime/markdown.ts
|
|
17363
|
-
var MARKDOWN_KEPT, USER_MARKDOWN, MARKDOWN_OPTIONS;
|
|
17860
|
+
var MARKDOWN_KEPT, USER_MARKDOWN, UNTOUCHED, MARKDOWN_OPTIONS;
|
|
17364
17861
|
var init_markdown = __esm(() => {
|
|
17365
17862
|
MARKDOWN_KEPT = { tags: ["img", "table", "thead", "tbody", "tr", "th", "td"], attributes: { img: ["src", "alt", "title"], th: ["align"], td: ["align"] } };
|
|
17366
|
-
USER_MARKDOWN = { ...MARKDOWN_KEPT, lazyImages: true };
|
|
17863
|
+
USER_MARKDOWN = { ...MARKDOWN_KEPT, attributes: { ...MARKDOWN_KEPT.attributes, code: ["class"] }, lazyImages: true };
|
|
17864
|
+
UNTOUCHED = new Set(["a", "code", "pre"]);
|
|
17367
17865
|
MARKDOWN_OPTIONS = { autolinks: true };
|
|
17368
17866
|
});
|
|
17369
17867
|
|
|
@@ -19090,9 +19588,11 @@ function compileKay(original, filename, options = {}) {
|
|
|
19090
19588
|
const hydratableServer = options.output === "html" && options.hydratable === true;
|
|
19091
19589
|
const twin = hydratableServer && !options.twinBuild && island === undefined && !routeFile ? `./${basename5(filename)}${ISLAND_TWIN}` : undefined;
|
|
19092
19590
|
const pin = file.pin;
|
|
19591
|
+
const hydrated = hydratableServer && (island !== undefined || options.twinBuild === true);
|
|
19592
|
+
const lazy = lazyImportsOf(file, script.imports, options, hydrated, routeFile, client);
|
|
19093
19593
|
const rawCause = island === undefined ? undefined : islandCause(file, script) ?? browserCause(file, script, live);
|
|
19094
19594
|
const cause = withInteractive(realCause(rawCause, expansion, original), script);
|
|
19095
|
-
const generateOptions = { cause: options.inspect === true && cause !== undefined ? describeCause(cause) : undefined, classTable: options.classTable, classMerge: options.classMerge, awaitAlert: options.awaitAlert, island, client, lives: island === undefined ? undefined : liveBindings(script, options.importedSignals).map((binding) => binding.local), twin, output: options.output, failedCode, hydratable:
|
|
19595
|
+
const generateOptions = { cause: options.inspect === true && cause !== undefined ? describeCause(cause) : undefined, classTable: options.classTable, classMerge: options.classMerge, awaitAlert: options.awaitAlert, island, client, lives: island === undefined ? undefined : liveBindings(script, options.importedSignals).map((binding) => binding.local), twin, writtenProps: options.writtenProps, output: options.output, failedCode, hydratable: hydrated, moduleId: islandId(filename, options.root), includeServer: options.includeServer, params: options.params, paramTypes: options.paramTypes, outerQueries: options.outerQueries, outerGuards: options.outerGuards, outerSlots: options.outerSlots, layoutFile: basename5(filename) === LAYOUT, component: options.page === false && !routeFile, check: options.check, route: options.check === true && pageFile, pageFile, namedRefresh: options.namedRefresh, insideIsland: options.insideIsland, inspect: options.inspect, inspectSource: expansion ? { text: original, real: (offset) => expansion.real(offset) } : undefined, relocateImport: options.relocateImport, lazy, contextModule: options.check === true ? options.contextModule : undefined, ui: options.output === undefined ? undefined : options.ui, uiAdded: options.output === undefined ? options.ui : undefined, errorPage: isErrorPage(basename5(filename)), cardPage: basename5(filename) === CARD_PAGE, special: basename5(filename).startsWith("_") && basename5(filename) !== LAYOUT };
|
|
19096
19596
|
const analysis = generate(file, script, server, { ...generateOptions, name: SELF });
|
|
19097
19597
|
const imported = new Map([...script.imports, ...server?.imports ?? []].flatMap((binding) => {
|
|
19098
19598
|
const kind = binding.typeOnly ? undefined : kindOf(options.importedSignals, binding.source, binding.imported);
|
|
@@ -19129,7 +19629,7 @@ function compileKay(original, filename, options = {}) {
|
|
|
19129
19629
|
const fenceLints = [script.fence, script.moduleFence, server?.fence].flatMap((fence) => fence ? [...cssImportsWithoutText(fence), ...asyncReplies(fence), ...openRedirects(fence), ...missingCaptchas(fence), ...unreturnedFails(fence)] : []);
|
|
19130
19630
|
const browserScript = (island !== undefined || options.insideIsland === true) && !routeFile ? scriptFences(script) : [];
|
|
19131
19631
|
const unusedLints = broken ? [] : [...unreadNames(source, file.template, script, server, found.findings), ...constantSignals(source, [file.script, file.module], found.findings)];
|
|
19132
|
-
diagnostics.push(...unboundedFields(server), ...fenceLints, ...serialAwaits(server), ...browserScript.flatMap((fence) => serverOnlyImports(fence)), ...browserScript.includes(script.fence) ? onceReadProps(script.fence, script.props, templateWords(file)) : [], ...unusedLints, ...templateLints(file), ...
|
|
19632
|
+
diagnostics.push(...unboundedFields(server), ...fenceLints, ...serialAwaits(server), ...browserScript.flatMap((fence) => serverOnlyImports(fence)), ...browserScript.includes(script.fence) ? onceReadProps(script.fence, script.props, templateWords(file)) : [], ...unusedLints, ...templateLints(file), ...retiredAllowComments(source), ...deprecatedIslandForms(file, script), ...deprecatedIslandAttributes(file), ...deprecatedChildrenProp(file, script), ...linkFlags(file), ...deprecatedPartsClass(file), ...deprecatedPageSettings(source, server), ...ignoredIslandExport(script, island !== undefined), ...malformedInteractive(script));
|
|
19133
19633
|
}
|
|
19134
19634
|
if (checked && pin !== undefined)
|
|
19135
19635
|
diagnostics.push(...markerMismatch(pin, pageFile));
|
|
@@ -19324,13 +19824,13 @@ var init_compiler = __esm(() => {
|
|
|
19324
19824
|
init_deprecated_island();
|
|
19325
19825
|
init_deprecated_page();
|
|
19326
19826
|
init_deprecated_parts();
|
|
19327
|
-
init_deprecated_script_fence();
|
|
19328
19827
|
init_fence_checks();
|
|
19329
19828
|
init_fence_redirects();
|
|
19330
19829
|
init_host();
|
|
19331
19830
|
init_island_arguments();
|
|
19332
19831
|
init_island_cause();
|
|
19333
19832
|
init_island_marker();
|
|
19833
|
+
init_lazy_imports();
|
|
19334
19834
|
init_link_flags();
|
|
19335
19835
|
init_lints();
|
|
19336
19836
|
init_mapping();
|
|
@@ -19371,9 +19871,27 @@ var init_object_literal = __esm(() => {
|
|
|
19371
19871
|
WRAPPERS2 = new Set(["TSAsExpression", "TSSatisfiesExpression", "TSNonNullExpression", "TSTypeAssertion"]);
|
|
19372
19872
|
});
|
|
19373
19873
|
|
|
19874
|
+
// src/build/ui-layers.ts
|
|
19875
|
+
import { realpathSync as realpathSync3 } from "node:fs";
|
|
19876
|
+
import { resolve as resolve6 } from "node:path";
|
|
19877
|
+
function rootKey(root) {
|
|
19878
|
+
try {
|
|
19879
|
+
return realpathSync3(root);
|
|
19880
|
+
} catch {
|
|
19881
|
+
return resolve6(root);
|
|
19882
|
+
}
|
|
19883
|
+
}
|
|
19884
|
+
function layerFilesOf(root) {
|
|
19885
|
+
return layerFiles.get(rootKey(root)) ?? [];
|
|
19886
|
+
}
|
|
19887
|
+
var layerFiles;
|
|
19888
|
+
var init_ui_layers = __esm(() => {
|
|
19889
|
+
layerFiles = new Map;
|
|
19890
|
+
});
|
|
19891
|
+
|
|
19374
19892
|
// src/build/ui.ts
|
|
19375
|
-
import { readdirSync, readFileSync as readFileSync7, realpathSync as
|
|
19376
|
-
import { basename as basename6, dirname as dirname7, join as join9 } from "node:path";
|
|
19893
|
+
import { readdirSync, readFileSync as readFileSync7, realpathSync as realpathSync4, statSync as statSync3 } from "node:fs";
|
|
19894
|
+
import { basename as basename6, dirname as dirname7, join as join9, resolve as resolve7 } from "node:path";
|
|
19377
19895
|
function record() {
|
|
19378
19896
|
return Object.create(null);
|
|
19379
19897
|
}
|
|
@@ -19516,16 +20034,19 @@ function isPage(file) {
|
|
|
19516
20034
|
}
|
|
19517
20035
|
function realOf(file) {
|
|
19518
20036
|
try {
|
|
19519
|
-
return
|
|
20037
|
+
return realpathSync4(file);
|
|
19520
20038
|
} catch {
|
|
19521
20039
|
return file;
|
|
19522
20040
|
}
|
|
19523
20041
|
}
|
|
20042
|
+
function baseOf(ui) {
|
|
20043
|
+
return ui.base ?? dirname7(ui.file);
|
|
20044
|
+
}
|
|
19524
20045
|
function nameIndex(ui) {
|
|
19525
20046
|
if (ui.index !== undefined && Date.now() - ui.index.at < INDEX_LIFETIME)
|
|
19526
20047
|
return ui.index;
|
|
19527
20048
|
const app = new Map;
|
|
19528
|
-
appComponents(
|
|
20049
|
+
appComponents(baseOf(ui), app);
|
|
19529
20050
|
ui.index = { at: Date.now(), app, matches: new Map };
|
|
19530
20051
|
return ui.index;
|
|
19531
20052
|
}
|
|
@@ -19536,7 +20057,7 @@ function componentsNamed(ui, name) {
|
|
|
19536
20057
|
return kept;
|
|
19537
20058
|
const found = (index.app.get(name) ?? []).map(realOf);
|
|
19538
20059
|
try {
|
|
19539
|
-
const library =
|
|
20060
|
+
const library = realpathSync4(Bun.resolveSync(`${UI_LIBRARY}/${name.replace(WORD_BOUNDARY, "-").toLowerCase()}.kay`, baseOf(ui)));
|
|
19540
20061
|
if (componentName(library) === name && !found.includes(library))
|
|
19541
20062
|
found.push(library);
|
|
19542
20063
|
} catch {}
|
|
@@ -19553,11 +20074,11 @@ function componentFile(ui, component) {
|
|
|
19553
20074
|
if (component.file !== undefined || !KAY_EXTENSION2.test(component.specifier))
|
|
19554
20075
|
return component.file;
|
|
19555
20076
|
try {
|
|
19556
|
-
component.file =
|
|
20077
|
+
component.file = realpathSync4(Bun.resolveSync(component.specifier, baseOf(ui)));
|
|
19557
20078
|
} catch {}
|
|
19558
20079
|
return component.file;
|
|
19559
20080
|
}
|
|
19560
|
-
function readUi(file) {
|
|
20081
|
+
function readUi(file, base) {
|
|
19561
20082
|
let source;
|
|
19562
20083
|
try {
|
|
19563
20084
|
source = readFileSync7(file, "utf8");
|
|
@@ -19569,7 +20090,7 @@ function readUi(file) {
|
|
|
19569
20090
|
try {
|
|
19570
20091
|
program = parseProgram(source).program;
|
|
19571
20092
|
} catch (error) {
|
|
19572
|
-
return { file, source, components: [], problems: [{ start: 0, end: 0, message: `src/ui.ts does not parse: ${error instanceof Error ? error.message : String(error)}` }] };
|
|
20093
|
+
return { file, source, base, components: [], problems: [{ start: 0, end: 0, message: `src/ui.ts does not parse: ${error instanceof Error ? error.message : String(error)}` }] };
|
|
19573
20094
|
}
|
|
19574
20095
|
const config = exported(program);
|
|
19575
20096
|
const components = [];
|
|
@@ -19582,7 +20103,7 @@ function readUi(file) {
|
|
|
19582
20103
|
components.push(component);
|
|
19583
20104
|
});
|
|
19584
20105
|
}
|
|
19585
|
-
return { file, source, components, problems };
|
|
20106
|
+
return { file, source, base, components, problems };
|
|
19586
20107
|
}
|
|
19587
20108
|
function uiOf(root) {
|
|
19588
20109
|
const file = join9(root, UI_FILE);
|
|
@@ -19599,26 +20120,71 @@ function uiOf(root) {
|
|
|
19599
20120
|
read.set(file, { stamp, ui });
|
|
19600
20121
|
return ui;
|
|
19601
20122
|
}
|
|
20123
|
+
function uiLayersOf(root) {
|
|
20124
|
+
const base = join9(resolve7(root), "src");
|
|
20125
|
+
const found = [];
|
|
20126
|
+
for (const file of layerFilesOf(root)) {
|
|
20127
|
+
const stat = statSync3(file, { throwIfNoEntry: false });
|
|
20128
|
+
const key = `${base}\x00${file}`;
|
|
20129
|
+
if (stat === undefined) {
|
|
20130
|
+
layerReads.delete(key);
|
|
20131
|
+
continue;
|
|
20132
|
+
}
|
|
20133
|
+
const stamp = `${stat.mtimeMs}:${stat.size}`;
|
|
20134
|
+
let kept = layerReads.get(key);
|
|
20135
|
+
if (kept?.stamp !== stamp)
|
|
20136
|
+
layerReads.set(key, kept = { stamp, ui: readUi(file, base) });
|
|
20137
|
+
if (kept.ui !== undefined)
|
|
20138
|
+
found.push(kept.ui);
|
|
20139
|
+
}
|
|
20140
|
+
return found;
|
|
20141
|
+
}
|
|
20142
|
+
function partsOf2(parts) {
|
|
20143
|
+
return typeof parts === "string" ? { root: parts } : { ...parts };
|
|
20144
|
+
}
|
|
20145
|
+
function mergeEntries(under, over) {
|
|
20146
|
+
const merged = {};
|
|
20147
|
+
if (under.parts !== undefined || over.parts !== undefined)
|
|
20148
|
+
merged.parts = { ...partsOf2(under.parts), ...partsOf2(over.parts) };
|
|
20149
|
+
if (under.variants !== undefined || over.variants !== undefined) {
|
|
20150
|
+
const variants = record();
|
|
20151
|
+
for (const source of [under.variants ?? {}, over.variants ?? {}]) {
|
|
20152
|
+
for (const [name, values] of Object.entries(source))
|
|
20153
|
+
variants[name] = Object.assign(record(), variants[name], values);
|
|
20154
|
+
}
|
|
20155
|
+
merged.variants = variants;
|
|
20156
|
+
}
|
|
20157
|
+
return merged;
|
|
20158
|
+
}
|
|
19602
20159
|
function uiEntryOf(root, file) {
|
|
19603
|
-
const
|
|
19604
|
-
|
|
20160
|
+
const app = uiOf(root);
|
|
20161
|
+
const sources = [...uiLayersOf(root), ...app === undefined ? [] : [app]];
|
|
20162
|
+
if (sources.every(({ components }) => components.length === 0))
|
|
19605
20163
|
return;
|
|
19606
20164
|
let real = file;
|
|
19607
20165
|
try {
|
|
19608
|
-
real =
|
|
20166
|
+
real = realpathSync4(file);
|
|
19609
20167
|
} catch {}
|
|
19610
|
-
|
|
20168
|
+
let entry;
|
|
20169
|
+
for (const ui of sources) {
|
|
20170
|
+
const found = ui.components.findLast((component) => componentFile(ui, component) === real)?.entry;
|
|
20171
|
+
if (found !== undefined)
|
|
20172
|
+
entry = entry === undefined ? found : mergeEntries(entry, found);
|
|
20173
|
+
}
|
|
20174
|
+
return entry;
|
|
19611
20175
|
}
|
|
19612
|
-
var UI_FILE = "src/ui.ts", KAY_EXTENSION2, COMPONENT_NAME, WORD_BOUNDARY, UI_LIBRARY = "@kayjs/ui", read, INDEX_LIFETIME = 1000;
|
|
20176
|
+
var UI_FILE = "src/ui.ts", KAY_EXTENSION2, COMPONENT_NAME, WORD_BOUNDARY, UI_LIBRARY = "@kayjs/ui", read, INDEX_LIFETIME = 1000, layerReads;
|
|
19613
20177
|
var init_ui = __esm(() => {
|
|
19614
20178
|
init_compiler();
|
|
19615
20179
|
init_estree();
|
|
19616
20180
|
init_object_literal();
|
|
19617
20181
|
init_parser();
|
|
20182
|
+
init_ui_layers();
|
|
19618
20183
|
KAY_EXTENSION2 = /\.kay$/;
|
|
19619
20184
|
COMPONENT_NAME = /^[A-Z_$][\w$]*$/i;
|
|
19620
20185
|
WORD_BOUNDARY = /(?<=[a-z0-9])(?=[A-Z])/g;
|
|
19621
20186
|
read = new Map;
|
|
20187
|
+
layerReads = new Map;
|
|
19622
20188
|
});
|
|
19623
20189
|
|
|
19624
20190
|
// src/server/bundle.ts
|
|
@@ -19796,7 +20362,7 @@ var init_config_shape = __esm(() => {
|
|
|
19796
20362
|
METRICS = { path: str, token: either(lit(true), SECRET) };
|
|
19797
20363
|
BUDGET = { js: bytes, css: bytes, weight: bytes, grade: oneOf("A", "B", "C", "D", "E", "F", "G") };
|
|
19798
20364
|
FAVICON = { image: str, svg: str };
|
|
19799
|
-
MANIFEST = { shortName: str, themeColor: either(str, bag({ light: str, dark: str })), backgroundColor: str, display: oneOf("fullscreen", "standalone", "minimal-ui", "browser"), orientation: oneOf("any", "natural", "landscape", "landscape-primary", "landscape-secondary", "portrait", "portrait-primary", "portrait-secondary"), startUrl: str, scope: str, maskable: str, shortcuts: list(obj) };
|
|
20365
|
+
MANIFEST = { shortName: str, themeColor: either(str, bag({ light: str, dark: str })), backgroundColor: str, display: oneOf("fullscreen", "standalone", "minimal-ui", "browser"), orientation: oneOf("any", "natural", "landscape", "landscape-primary", "landscape-secondary", "portrait", "portrait-primary", "portrait-secondary"), startUrl: str, scope: str, maskable: str, shortcuts: list(obj), shareTarget: bag({ action: str, files: list(str), params: bag({ title: str, text: str, url: str, files: str }) }) };
|
|
19800
20366
|
MARKDOWN = { highlight: fn, transform: fn, preprocess: fn, containers: bool, footnotes: bool, headingLinks: bool, readingSpeed: num, imageSizes: str };
|
|
19801
20367
|
CARD = { font: bag({ family: str, weight: num }), background: str, color: str, logo: str };
|
|
19802
20368
|
AVIF = either(bool, bag({ quality: num }));
|
|
@@ -19891,6 +20457,7 @@ var init_env_state = __esm(() => {
|
|
|
19891
20457
|
var lightConfigs, implicitPlugins;
|
|
19892
20458
|
var init_config_loader = __esm(() => {
|
|
19893
20459
|
init_manifests();
|
|
20460
|
+
init_ui_layers();
|
|
19894
20461
|
init_errors();
|
|
19895
20462
|
init_config_resolve();
|
|
19896
20463
|
init_config_shape();
|
|
@@ -19968,7 +20535,7 @@ init_package();
|
|
|
19968
20535
|
import { spawnSync } from "node:child_process";
|
|
19969
20536
|
import { existsSync as existsSync6 } from "node:fs";
|
|
19970
20537
|
import { createRequire as createRequire3 } from "node:module";
|
|
19971
|
-
import { dirname as dirname9, join as join12, relative as relative4, resolve as
|
|
20538
|
+
import { dirname as dirname9, join as join12, relative as relative4, resolve as resolve9 } from "node:path";
|
|
19972
20539
|
|
|
19973
20540
|
// src/check/class-words.ts
|
|
19974
20541
|
init_ast();
|
|
@@ -20133,8 +20700,8 @@ init_compiler();
|
|
|
20133
20700
|
init_ast();
|
|
20134
20701
|
init_parser();
|
|
20135
20702
|
init_project();
|
|
20136
|
-
import { existsSync as existsSync5, readdirSync as readdirSync2, readFileSync as readFileSync8, realpathSync as
|
|
20137
|
-
import { basename as basename7, dirname as dirname8, join as join11, relative as relative3, resolve as
|
|
20703
|
+
import { existsSync as existsSync5, readdirSync as readdirSync2, readFileSync as readFileSync8, realpathSync as realpathSync5, statSync as statSync4 } from "node:fs";
|
|
20704
|
+
import { basename as basename7, dirname as dirname8, join as join11, relative as relative3, resolve as resolve8, sep as sep4 } from "node:path";
|
|
20138
20705
|
|
|
20139
20706
|
// src/runtime/params.ts
|
|
20140
20707
|
var INTEGER = /^-?\d+$/;
|
|
@@ -20195,14 +20762,14 @@ var GUARD = "_guard.ts";
|
|
|
20195
20762
|
var PARENT = "..";
|
|
20196
20763
|
var OUTSIDE = "__";
|
|
20197
20764
|
var WORD_CHARACTER = /[\w$]/;
|
|
20198
|
-
var
|
|
20765
|
+
var codeOf3 = new WeakMap;
|
|
20199
20766
|
function shadowPath(root, file) {
|
|
20200
20767
|
return join11(projectPaths(root).types, `${relative3(root, file).split(sep4).map((part) => part === PARENT ? OUTSIDE : part).join(sep4)}.tsx`);
|
|
20201
20768
|
}
|
|
20202
20769
|
function readShadowSettings(root) {
|
|
20203
20770
|
try {
|
|
20204
20771
|
const saved = JSON.parse(readFileSync8(join11(projectPaths(root).types, SHADOW_SETTINGS), "utf8"));
|
|
20205
|
-
return { routesDir:
|
|
20772
|
+
return { routesDir: resolve8(root, saved.routes), mounts: (saved.mounts ?? []).map((mount) => typeof mount === "string" ? { dir: resolve8(root, mount), prefix: "" } : { ...mount, dir: resolve8(root, mount.dir), ...mount.outer !== undefined && { outer: resolve8(root, mount.outer) } }), islandOnly: new Set(saved.islandOnly.map((file) => resolve8(root, file))), publicDir: resolve8(root, saved.public ?? projectPaths(root).public), lints: saved.lints };
|
|
20206
20773
|
} catch {
|
|
20207
20774
|
return { routesDir: projectPaths(root).routes, mounts: [], islandOnly: new Set };
|
|
20208
20775
|
}
|
|
@@ -20217,7 +20784,7 @@ function compileShadow(root, file, source, { routesDir, mounts, insideIsland = f
|
|
|
20217
20784
|
const relocateImport = (specifier) => {
|
|
20218
20785
|
if (!specifier.startsWith("."))
|
|
20219
20786
|
return;
|
|
20220
|
-
const target =
|
|
20787
|
+
const target = resolve8(dirname8(file), specifier);
|
|
20221
20788
|
if (moved)
|
|
20222
20789
|
return relativeSpecifier(shadowDir, KAY_FILE.test(target) ? shadowOf(target).slice(0, -".tsx".length) : target);
|
|
20223
20790
|
if (target.startsWith(root + sep4) || KAY_FILE.test(target) && !file.startsWith(root + sep4))
|
|
@@ -20331,10 +20898,10 @@ function inFences(shadow, start, end) {
|
|
|
20331
20898
|
return codeIn(shadow).fences.some((span) => start >= span.start && end <= span.end);
|
|
20332
20899
|
}
|
|
20333
20900
|
function codeIn(shadow) {
|
|
20334
|
-
let spans =
|
|
20901
|
+
let spans = codeOf3.get(shadow);
|
|
20335
20902
|
if (!spans) {
|
|
20336
20903
|
const { script, server, module, template } = parseKay(shadow.source);
|
|
20337
|
-
|
|
20904
|
+
codeOf3.set(shadow, spans = { fences: [script, server, module].filter((span) => span !== undefined), expressions: expressionSpans(template) });
|
|
20338
20905
|
}
|
|
20339
20906
|
return spans;
|
|
20340
20907
|
}
|
|
@@ -20349,7 +20916,7 @@ function pageRoute(file, routesDir, mounts) {
|
|
|
20349
20916
|
const pagesDir = mounts.find(({ dir }) => file.startsWith(dir + sep4))?.dir ?? routesDir;
|
|
20350
20917
|
if (file.startsWith(pagesDir + sep4))
|
|
20351
20918
|
return routeOf(pagesDir, file);
|
|
20352
|
-
const real = mounts.length > 0 && file.includes(NODE_MODULES) && existsSync5(file) ?
|
|
20919
|
+
const real = mounts.length > 0 && file.includes(NODE_MODULES) && existsSync5(file) ? realpathSync5(file) : file;
|
|
20353
20920
|
const mount = real === file ? undefined : mounts.find(({ dir }) => real.startsWith(dir + sep4));
|
|
20354
20921
|
return mount ? routeOf(mount.dir, real) : undefined;
|
|
20355
20922
|
}
|
|
@@ -20392,7 +20959,7 @@ var processor = {
|
|
|
20392
20959
|
meta: { name: "kay", version },
|
|
20393
20960
|
supportsAutofix: true,
|
|
20394
20961
|
preprocess(text, filename) {
|
|
20395
|
-
const file =
|
|
20962
|
+
const file = resolve9(filename);
|
|
20396
20963
|
const root = projectRootOf(file);
|
|
20397
20964
|
const { shadow } = compileShadow(root, file, text, shadowOptionsFor(readShadowSettings(root), file));
|
|
20398
20965
|
const indented = shadow.bodyLines ?? [];
|
|
@@ -20471,7 +21038,7 @@ var NON_BLANK = /\S/;
|
|
|
20471
21038
|
var NON_BLANK_OR_END = /\S|$/;
|
|
20472
21039
|
var SPACE7 = /\s/;
|
|
20473
21040
|
var INDENTATION = /^[ \t]*$/;
|
|
20474
|
-
var
|
|
21041
|
+
var LINE_COMMENT2 = /\/\/.*$/;
|
|
20475
21042
|
var STATEMENT_START2 = /[^\s)\]}]/;
|
|
20476
21043
|
var EXPECTED_SPACES = /of (\d+) spaces?/;
|
|
20477
21044
|
var FOUND_SPACES = /found (\d+)\./;
|
|
@@ -20574,7 +21141,7 @@ function alignedAfterRewrite(linted, line) {
|
|
|
20574
21141
|
} else if (character === "(" || character === "[" || character === "{") {
|
|
20575
21142
|
const call = character === "(";
|
|
20576
21143
|
const opened = lineStart(tsx, at);
|
|
20577
|
-
brackets.push({ call, line: opened, aligned: call && NON_BLANK.test(tsx.slice(at + 1, lineEnd2(tsx, at)).replace(
|
|
21144
|
+
brackets.push({ call, line: opened, aligned: call && NON_BLANK.test(tsx.slice(at + 1, lineEnd2(tsx, at)).replace(LINE_COMMENT2, "")), arguments: 0, pending: call, locked: false });
|
|
20578
21145
|
} else if (character === ")" || character === "]" || character === "}") {
|
|
20579
21146
|
brackets.pop();
|
|
20580
21147
|
} else if (character === "," && top?.call) {
|