@kayjs/kay 1.108.0 → 1.110.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (595) hide show
  1. package/dist/eslint.js +2093 -3774
  2. package/editors/zed/extension.toml +2 -2
  3. package/llms/action-protection.md +1 -1
  4. package/llms/actions-from-islands.md +5 -5
  5. package/llms/actions-refused-fields.md +4 -4
  6. package/llms/api-from-islands.md +6 -6
  7. package/llms/browser-only.md +2 -2
  8. package/llms/cdn-caching.md +1 -1
  9. package/llms/checks.md +1 -1
  10. package/llms/code-lints.md +1 -2
  11. package/llms/component-library-conventions.md +1 -1
  12. package/llms/components.md +5 -5
  13. package/llms/deprecated-lints.md +2 -7
  14. package/llms/effects.md +1 -1
  15. package/llms/errors.md +2 -2
  16. package/llms/events.md +1 -1
  17. package/llms/guards.md +1 -1
  18. package/llms/head.md +1 -1
  19. package/llms/hooks.md +2 -2
  20. package/llms/images.md +1 -1
  21. package/llms/island-and-form-lints.md +4 -2
  22. package/llms/island-sources.md +1 -1
  23. package/llms/islands-state-to-ids.md +2 -2
  24. package/llms/islands.md +8 -4
  25. package/llms/lints.md +1 -1
  26. package/llms/live-values.md +4 -4
  27. package/llms/local-collections.md +1 -1
  28. package/llms/locales.md +1 -1
  29. package/llms/mcp.md +2 -2
  30. package/llms/metrics.md +1 -1
  31. package/llms/navigation-from-code.md +7 -7
  32. package/llms/navigation.md +4 -2
  33. package/llms/prerendering.md +1 -0
  34. package/llms/production.md +2 -2
  35. package/llms/project-new-and-add.md +1 -1
  36. package/llms/project.md +4 -4
  37. package/llms/proxy-and-security.md +1 -1
  38. package/llms/queues.md +1 -1
  39. package/llms/rate-limits.md +4 -4
  40. package/llms/rendering.md +1 -1
  41. package/llms/server-islands.md +2 -2
  42. package/llms/server.md +1 -1
  43. package/llms/stores.md +1 -1
  44. package/llms/styles-and-assets.md +1 -1
  45. package/llms/templates-elements-slots-snippets.md +2 -2
  46. package/llms/testing-mount.md +49 -0
  47. package/llms/testing.md +4 -45
  48. package/llms/upgrading-1-105-config.md +13 -13
  49. package/llms/upgrading-archive.md +64 -74
  50. package/llms/upgrading.md +92 -70
  51. package/llms/whats-new.md +24 -0
  52. package/llms.txt +5 -6
  53. package/package.json +6 -10
  54. package/src/build/route-sizes.ts +2 -3
  55. package/src/build/variants.ts +132 -18
  56. package/src/check/browser-global-reads.ts +2 -2
  57. package/src/check/config-objects.ts +1 -1
  58. package/src/check/diagnose.ts +0 -22
  59. package/src/check/env-types.ts +1 -1
  60. package/src/check/export-homes.ts +1 -1
  61. package/src/check/guards.ts +3 -3
  62. package/src/check/index.ts +2 -7
  63. package/src/check/moved-keys.ts +1 -1
  64. package/src/check/project.ts +6 -7
  65. package/src/check/schema-builders.ts +125 -26
  66. package/src/check/shadow-types.ts +0 -86
  67. package/src/commands/check.ts +2 -2
  68. package/src/commands/env.ts +25 -3
  69. package/src/commands/upgrade.ts +2 -1
  70. package/src/compiler/allow-comments.ts +38 -2
  71. package/src/compiler/ast.ts +21 -19
  72. package/src/compiler/browser.ts +2 -14
  73. package/src/compiler/class-items.ts +16 -0
  74. package/src/compiler/codegen.ts +10 -10
  75. package/src/compiler/deprecated-library.ts +0 -12
  76. package/src/compiler/deprecated-lints-1-106.ts +2 -2
  77. package/src/compiler/deprecated-lints.ts +3 -495
  78. package/src/compiler/deprecated-ui-props.ts +5 -5
  79. package/src/compiler/errors.ts +2 -2
  80. package/src/compiler/fence-checks.ts +2 -121
  81. package/src/compiler/hand-parts.ts +83 -0
  82. package/src/compiler/helper-imports.ts +2 -2
  83. package/src/compiler/image-attributes.ts +1 -3
  84. package/src/compiler/index.ts +23 -23
  85. package/src/compiler/island-arguments.ts +17 -95
  86. package/src/compiler/island-cause.ts +7 -7
  87. package/src/compiler/island-declaration.ts +2 -8
  88. package/src/compiler/island-lints.ts +19 -0
  89. package/src/compiler/island-marker.ts +3 -3
  90. package/src/compiler/island-problems.ts +25 -0
  91. package/src/compiler/items.ts +12 -0
  92. package/src/compiler/jsx-class.ts +1 -25
  93. package/src/compiler/jsx.ts +7 -6
  94. package/src/compiler/kay-exports.ts +0 -2
  95. package/src/compiler/link-flags.ts +9 -38
  96. package/src/compiler/lints.ts +10 -18
  97. package/src/compiler/markup.ts +33 -41
  98. package/src/compiler/module-signals.ts +2 -2
  99. package/src/compiler/names.ts +1 -1
  100. package/src/compiler/page-settings.ts +11 -0
  101. package/src/compiler/parser.ts +6 -8
  102. package/src/compiler/plan.ts +1 -3
  103. package/src/compiler/removed-lints.ts +90 -0
  104. package/src/compiler/rewrite.ts +3 -18
  105. package/src/compiler/script-server.ts +8 -3
  106. package/src/compiler/signal-from-prop.ts +141 -0
  107. package/src/compiler/template-reads.ts +16 -0
  108. package/src/compiler/validate.ts +3 -8
  109. package/src/config-loader.ts +14 -4
  110. package/src/config-resolve.ts +18 -142
  111. package/src/config-shape.ts +44 -34
  112. package/src/config.ts +10 -114
  113. package/src/dev/preload.ts +4 -1
  114. package/src/lsp/server.ts +4 -0
  115. package/src/migrate/markup.ts +4 -1
  116. package/src/runtime/action-call.ts +0 -8
  117. package/src/runtime/action-encode.ts +26 -0
  118. package/src/runtime/action-error.ts +3 -11
  119. package/src/runtime/action-protection.ts +2 -2
  120. package/src/runtime/action-run.ts +2 -27
  121. package/src/runtime/action-shared.ts +14 -37
  122. package/src/runtime/action-stream.ts +0 -1
  123. package/src/runtime/action.ts +1 -1
  124. package/src/runtime/call-result.ts +2 -10
  125. package/src/runtime/checks.ts +25 -13
  126. package/src/runtime/client.ts +7 -11
  127. package/src/runtime/core.ts +5 -23
  128. package/src/runtime/dom.ts +1 -1
  129. package/src/runtime/html.ts +1 -1
  130. package/src/runtime/i18n.client.ts +1 -4
  131. package/src/runtime/i18n.server.ts +1 -4
  132. package/src/runtime/i18n.ts +3 -3
  133. package/src/runtime/image.ts +2 -19
  134. package/src/runtime/index.ts +3 -3
  135. package/src/runtime/island.server.ts +56 -13
  136. package/src/runtime/live-resource.server.ts +0 -1
  137. package/src/runtime/live-value.server.ts +2 -2
  138. package/src/runtime/live-value.shared.ts +7 -20
  139. package/src/runtime/live.ts +1 -12
  140. package/src/runtime/local-types.ts +1 -11
  141. package/src/runtime/local.ts +4 -14
  142. package/src/runtime/navigate-api.ts +2 -5
  143. package/src/runtime/navigate.ts +9 -0
  144. package/src/runtime/navigation-state.ts +0 -12
  145. package/src/runtime/navigation.ts +5 -1
  146. package/src/runtime/page-swap.ts +8 -8
  147. package/src/runtime/persist.ts +11 -3
  148. package/src/runtime/persisted.ts +4 -30
  149. package/src/runtime/presence.ts +6 -7
  150. package/src/runtime/query-param.ts +20 -12
  151. package/src/runtime/reactive.ts +3 -1
  152. package/src/runtime/refuse.ts +3 -17
  153. package/src/runtime/store-base.ts +4 -6
  154. package/src/runtime/swap-fetch.ts +1 -1
  155. package/src/runtime/swap-flight.ts +10 -10
  156. package/src/runtime/swap-kept.ts +69 -29
  157. package/src/runtime/swap-morph.ts +49 -9
  158. package/src/runtime/text-hash.ts +17 -0
  159. package/src/runtime/uid.server.ts +6 -4
  160. package/src/runtime/values.ts +52 -23
  161. package/src/runtime/with-query.ts +9 -0
  162. package/src/server/action-hooks.ts +8 -8
  163. package/src/server/actions.ts +13 -14
  164. package/src/server/api-modules.ts +2 -3
  165. package/src/server/app-stages.ts +15 -33
  166. package/src/server/app.ts +10 -5
  167. package/src/server/auth-mails.ts +0 -2
  168. package/src/server/env-state.ts +40 -10
  169. package/src/server/flash.ts +1 -1
  170. package/src/server/guard-requirement.ts +4 -4
  171. package/src/server/image.ts +2 -2
  172. package/src/server/index.ts +0 -2
  173. package/src/server/job-context.ts +3 -3
  174. package/src/server/jobs-page.ts +1 -1
  175. package/src/server/jobs.ts +5 -9
  176. package/src/server/kept-exports.ts +0 -2
  177. package/src/server/kv.ts +11 -14
  178. package/src/server/library.ts +1 -3
  179. package/src/server/live.ts +2 -2
  180. package/src/server/mcp.ts +3 -9
  181. package/src/server/metrics.ts +2 -4
  182. package/src/server/page-settings.ts +10 -19
  183. package/src/server/prerender.ts +19 -2
  184. package/src/server/protection.ts +15 -18
  185. package/src/server/queue.ts +3 -6
  186. package/src/server/rate-limit.ts +0 -3
  187. package/src/server/render-document.ts +9 -7
  188. package/src/server/render.ts +1 -1
  189. package/src/server/routes.ts +7 -3
  190. package/src/server/scope.ts +3 -2
  191. package/src/server/session.ts +5 -6
  192. package/src/server/setup.ts +1 -1
  193. package/src/server/signals.ts +17 -7
  194. package/src/server/signed.ts +1 -3
  195. package/src/server/source.ts +20 -4
  196. package/src/server/speculation.ts +1 -1
  197. package/src/server/storage.ts +3 -8
  198. package/src/server/validate.ts +1 -1
  199. package/src/server/vitals.ts +1 -3
  200. package/src/server/work-scope.ts +2 -4
  201. package/src/server/work.ts +1 -1
  202. package/src/server/workflow.ts +1 -1
  203. package/src/test/index.ts +2 -1
  204. package/src/test/site-actions.ts +16 -6
  205. package/src/test/site-keys.ts +10 -15
  206. package/src/test/site-socket.ts +1 -2
  207. package/src/test/site-types.ts +0 -8
  208. package/types/build/route-sizes.d.ts.map +1 -1
  209. package/types/build/variants.d.ts +9 -1
  210. package/types/build/variants.d.ts.map +1 -1
  211. package/types/check/diagnose.d.ts.map +1 -1
  212. package/types/check/index.d.ts +1 -2
  213. package/types/check/index.d.ts.map +1 -1
  214. package/types/check/project.d.ts.map +1 -1
  215. package/types/check/schema-builders.d.ts.map +1 -1
  216. package/types/check/shadow-types.d.ts.map +1 -1
  217. package/types/commands/env.d.ts.map +1 -1
  218. package/types/commands/upgrade.d.ts.map +1 -1
  219. package/types/compiler/allow-comments.d.ts +2 -0
  220. package/types/compiler/allow-comments.d.ts.map +1 -1
  221. package/types/compiler/ast.d.ts +1 -2
  222. package/types/compiler/ast.d.ts.map +1 -1
  223. package/types/compiler/browser.d.ts.map +1 -1
  224. package/types/compiler/class-items.d.ts +7 -0
  225. package/types/compiler/class-items.d.ts.map +1 -0
  226. package/types/compiler/deprecated-library.d.ts.map +1 -1
  227. package/types/compiler/deprecated-lints-1-106.d.ts +2 -2
  228. package/types/compiler/deprecated-lints-1-106.d.ts.map +1 -1
  229. package/types/compiler/deprecated-lints.d.ts +2 -553
  230. package/types/compiler/deprecated-lints.d.ts.map +1 -1
  231. package/types/compiler/deprecated-ui-props.d.ts +1 -8
  232. package/types/compiler/deprecated-ui-props.d.ts.map +1 -1
  233. package/types/compiler/errors.d.ts +2 -2
  234. package/types/compiler/errors.d.ts.map +1 -1
  235. package/types/compiler/fence-checks.d.ts +0 -1
  236. package/types/compiler/fence-checks.d.ts.map +1 -1
  237. package/types/compiler/hand-parts.d.ts +10 -0
  238. package/types/compiler/hand-parts.d.ts.map +1 -0
  239. package/types/compiler/image-attributes.d.ts +0 -1
  240. package/types/compiler/image-attributes.d.ts.map +1 -1
  241. package/types/compiler/index.d.ts.map +1 -1
  242. package/types/compiler/island-arguments.d.ts +7 -11
  243. package/types/compiler/island-arguments.d.ts.map +1 -1
  244. package/types/compiler/island-cause.d.ts +1 -1
  245. package/types/compiler/island-cause.d.ts.map +1 -1
  246. package/types/compiler/island-declaration.d.ts +1 -3
  247. package/types/compiler/island-declaration.d.ts.map +1 -1
  248. package/types/compiler/island-lints.d.ts +17 -0
  249. package/types/compiler/island-lints.d.ts.map +1 -0
  250. package/types/compiler/island-problems.d.ts +7 -0
  251. package/types/compiler/island-problems.d.ts.map +1 -0
  252. package/types/compiler/items.d.ts +1 -0
  253. package/types/compiler/items.d.ts.map +1 -1
  254. package/types/compiler/jsx-class.d.ts +1 -2
  255. package/types/compiler/jsx-class.d.ts.map +1 -1
  256. package/types/compiler/jsx.d.ts.map +1 -1
  257. package/types/compiler/kay-exports.d.ts.map +1 -1
  258. package/types/compiler/link-flags.d.ts +0 -6
  259. package/types/compiler/link-flags.d.ts.map +1 -1
  260. package/types/compiler/lints.d.ts +21 -566
  261. package/types/compiler/lints.d.ts.map +1 -1
  262. package/types/compiler/markup.d.ts +1 -1
  263. package/types/compiler/markup.d.ts.map +1 -1
  264. package/types/compiler/module-signals.d.ts.map +1 -1
  265. package/types/compiler/names.d.ts.map +1 -1
  266. package/types/compiler/page-settings.d.ts +4 -0
  267. package/types/compiler/page-settings.d.ts.map +1 -1
  268. package/types/compiler/parser.d.ts.map +1 -1
  269. package/types/compiler/plan.d.ts.map +1 -1
  270. package/types/compiler/removed-lints.d.ts +3 -0
  271. package/types/compiler/removed-lints.d.ts.map +1 -0
  272. package/types/compiler/script-server.d.ts.map +1 -1
  273. package/types/compiler/signal-from-prop.d.ts +4 -0
  274. package/types/compiler/signal-from-prop.d.ts.map +1 -0
  275. package/types/compiler/template-reads.d.ts +1 -0
  276. package/types/compiler/template-reads.d.ts.map +1 -1
  277. package/types/compiler/validate.d.ts.map +1 -1
  278. package/types/config-loader.d.ts.map +1 -1
  279. package/types/config-resolve.d.ts.map +1 -1
  280. package/types/config-shape.d.ts +1 -1
  281. package/types/config-shape.d.ts.map +1 -1
  282. package/types/config.d.ts +5 -105
  283. package/types/config.d.ts.map +1 -1
  284. package/types/dev/preload.d.ts.map +1 -1
  285. package/types/lsp/server.d.ts.map +1 -1
  286. package/types/migrate/markup.d.ts.map +1 -1
  287. package/types/runtime/action-call.d.ts.map +1 -1
  288. package/types/runtime/action-encode.d.ts +1 -0
  289. package/types/runtime/action-encode.d.ts.map +1 -1
  290. package/types/runtime/action-error.d.ts +1 -2
  291. package/types/runtime/action-error.d.ts.map +1 -1
  292. package/types/runtime/action-run.d.ts.map +1 -1
  293. package/types/runtime/action-shared.d.ts +1 -27
  294. package/types/runtime/action-shared.d.ts.map +1 -1
  295. package/types/runtime/action-stream.d.ts.map +1 -1
  296. package/types/runtime/action.d.ts +1 -1
  297. package/types/runtime/action.d.ts.map +1 -1
  298. package/types/runtime/call-result.d.ts +0 -10
  299. package/types/runtime/call-result.d.ts.map +1 -1
  300. package/types/runtime/checks.d.ts +14 -11
  301. package/types/runtime/checks.d.ts.map +1 -1
  302. package/types/runtime/client.d.ts.map +1 -1
  303. package/types/runtime/core.d.ts +2 -20
  304. package/types/runtime/core.d.ts.map +1 -1
  305. package/types/runtime/dom.d.ts +1 -1
  306. package/types/runtime/dom.d.ts.map +1 -1
  307. package/types/runtime/html.d.ts +1 -1
  308. package/types/runtime/html.d.ts.map +1 -1
  309. package/types/runtime/i18n.client.d.ts +0 -1
  310. package/types/runtime/i18n.client.d.ts.map +1 -1
  311. package/types/runtime/i18n.d.ts +1 -1
  312. package/types/runtime/i18n.d.ts.map +1 -1
  313. package/types/runtime/i18n.server.d.ts +0 -1
  314. package/types/runtime/i18n.server.d.ts.map +1 -1
  315. package/types/runtime/image.d.ts.map +1 -1
  316. package/types/runtime/index.d.ts +3 -3
  317. package/types/runtime/index.d.ts.map +1 -1
  318. package/types/runtime/island.server.d.ts +2 -0
  319. package/types/runtime/island.server.d.ts.map +1 -1
  320. package/types/runtime/live-resource.server.d.ts.map +1 -1
  321. package/types/runtime/live-value.shared.d.ts +7 -15
  322. package/types/runtime/live-value.shared.d.ts.map +1 -1
  323. package/types/runtime/live.d.ts +0 -11
  324. package/types/runtime/live.d.ts.map +1 -1
  325. package/types/runtime/local-types.d.ts +0 -14
  326. package/types/runtime/local-types.d.ts.map +1 -1
  327. package/types/runtime/navigate-api.d.ts +0 -4
  328. package/types/runtime/navigate-api.d.ts.map +1 -1
  329. package/types/runtime/navigate.d.ts.map +1 -1
  330. package/types/runtime/navigation-state.d.ts +0 -4
  331. package/types/runtime/navigation-state.d.ts.map +1 -1
  332. package/types/runtime/navigation.d.ts +2 -0
  333. package/types/runtime/navigation.d.ts.map +1 -1
  334. package/types/runtime/page-swap.d.ts.map +1 -1
  335. package/types/runtime/persist.d.ts +1 -0
  336. package/types/runtime/persist.d.ts.map +1 -1
  337. package/types/runtime/persisted.d.ts +0 -15
  338. package/types/runtime/persisted.d.ts.map +1 -1
  339. package/types/runtime/presence.d.ts +0 -2
  340. package/types/runtime/presence.d.ts.map +1 -1
  341. package/types/runtime/query-param.d.ts.map +1 -1
  342. package/types/runtime/reactive.d.ts +2 -1
  343. package/types/runtime/reactive.d.ts.map +1 -1
  344. package/types/runtime/refuse.d.ts +0 -7
  345. package/types/runtime/refuse.d.ts.map +1 -1
  346. package/types/runtime/store-base.d.ts +1 -2
  347. package/types/runtime/store-base.d.ts.map +1 -1
  348. package/types/runtime/swap-flight.d.ts +1 -1
  349. package/types/runtime/swap-flight.d.ts.map +1 -1
  350. package/types/runtime/swap-kept.d.ts.map +1 -1
  351. package/types/runtime/swap-morph.d.ts.map +1 -1
  352. package/types/runtime/text-hash.d.ts +2 -0
  353. package/types/runtime/text-hash.d.ts.map +1 -0
  354. package/types/runtime/uid.server.d.ts.map +1 -1
  355. package/types/runtime/values.d.ts +6 -1
  356. package/types/runtime/values.d.ts.map +1 -1
  357. package/types/runtime/with-query.d.ts +2 -0
  358. package/types/runtime/with-query.d.ts.map +1 -1
  359. package/types/server/action-hooks.d.ts +4 -4
  360. package/types/server/action-hooks.d.ts.map +1 -1
  361. package/types/server/actions.d.ts.map +1 -1
  362. package/types/server/api-modules.d.ts +0 -1
  363. package/types/server/api-modules.d.ts.map +1 -1
  364. package/types/server/app-stages.d.ts +5 -13
  365. package/types/server/app-stages.d.ts.map +1 -1
  366. package/types/server/app.d.ts +3 -8
  367. package/types/server/app.d.ts.map +1 -1
  368. package/types/server/auth-mails.d.ts +0 -5
  369. package/types/server/auth-mails.d.ts.map +1 -1
  370. package/types/server/env-state.d.ts +1 -0
  371. package/types/server/env-state.d.ts.map +1 -1
  372. package/types/server/guard-requirement.d.ts +0 -1
  373. package/types/server/guard-requirement.d.ts.map +1 -1
  374. package/types/server/image.d.ts +0 -1
  375. package/types/server/image.d.ts.map +1 -1
  376. package/types/server/index.d.ts +0 -2
  377. package/types/server/index.d.ts.map +1 -1
  378. package/types/server/job-context.d.ts +1 -1
  379. package/types/server/job-context.d.ts.map +1 -1
  380. package/types/server/jobs.d.ts +0 -4
  381. package/types/server/jobs.d.ts.map +1 -1
  382. package/types/server/kept-exports.d.ts.map +1 -1
  383. package/types/server/kv.d.ts +4 -4
  384. package/types/server/kv.d.ts.map +1 -1
  385. package/types/server/library.d.ts +1 -3
  386. package/types/server/library.d.ts.map +1 -1
  387. package/types/server/mcp.d.ts +0 -1
  388. package/types/server/mcp.d.ts.map +1 -1
  389. package/types/server/metrics.d.ts +0 -5
  390. package/types/server/metrics.d.ts.map +1 -1
  391. package/types/server/page-settings.d.ts +3 -3
  392. package/types/server/page-settings.d.ts.map +1 -1
  393. package/types/server/prerender.d.ts.map +1 -1
  394. package/types/server/protection.d.ts +6 -6
  395. package/types/server/protection.d.ts.map +1 -1
  396. package/types/server/queue.d.ts +1 -3
  397. package/types/server/queue.d.ts.map +1 -1
  398. package/types/server/rate-limit.d.ts +0 -2
  399. package/types/server/rate-limit.d.ts.map +1 -1
  400. package/types/server/render-document.d.ts +1 -1
  401. package/types/server/render-document.d.ts.map +1 -1
  402. package/types/server/routes.d.ts +1 -1
  403. package/types/server/routes.d.ts.map +1 -1
  404. package/types/server/scope.d.ts.map +1 -1
  405. package/types/server/session.d.ts +1 -1
  406. package/types/server/session.d.ts.map +1 -1
  407. package/types/server/signals.d.ts.map +1 -1
  408. package/types/server/signed.d.ts +0 -2
  409. package/types/server/signed.d.ts.map +1 -1
  410. package/types/server/source.d.ts +1 -1
  411. package/types/server/source.d.ts.map +1 -1
  412. package/types/server/storage.d.ts +0 -4
  413. package/types/server/storage.d.ts.map +1 -1
  414. package/types/server/vitals.d.ts +0 -1
  415. package/types/server/vitals.d.ts.map +1 -1
  416. package/types/server/work-scope.d.ts +0 -2
  417. package/types/server/work-scope.d.ts.map +1 -1
  418. package/types/server/workflow.d.ts +1 -1
  419. package/types/server/workflow.d.ts.map +1 -1
  420. package/types/test/index.d.ts.map +1 -1
  421. package/types/test/site-actions.d.ts +1 -1
  422. package/types/test/site-actions.d.ts.map +1 -1
  423. package/types/test/site-keys.d.ts +1 -1
  424. package/types/test/site-keys.d.ts.map +1 -1
  425. package/types/test/site-socket.d.ts +1 -1
  426. package/types/test/site-socket.d.ts.map +1 -1
  427. package/types/test/site-types.d.ts +0 -8
  428. package/types/test/site-types.d.ts.map +1 -1
  429. package/llms/deprecated-lints-1-105-libraries.md +0 -32
  430. package/llms/deprecated-lints-1-105.md +0 -58
  431. package/src/check/action-readers.ts +0 -115
  432. package/src/check/action-type.ts +0 -44
  433. package/src/check/ai-language.ts +0 -56
  434. package/src/check/app-hooks.ts +0 -90
  435. package/src/check/auth-methods.ts +0 -85
  436. package/src/check/auth-rate-limits.ts +0 -99
  437. package/src/check/call-result.ts +0 -242
  438. package/src/check/client-keys.ts +0 -10
  439. package/src/check/cms-options.ts +0 -81
  440. package/src/check/config-groups.ts +0 -22
  441. package/src/check/config-switches.ts +0 -38
  442. package/src/check/context-import.ts +0 -51
  443. package/src/check/env-files.ts +0 -31
  444. package/src/check/format-duration.ts +0 -75
  445. package/src/check/guard-options.ts +0 -58
  446. package/src/check/handler-events.ts +0 -149
  447. package/src/check/hook-context.ts +0 -94
  448. package/src/check/hook-names.ts +0 -104
  449. package/src/check/i18n-keys.ts +0 -50
  450. package/src/check/images-keys.ts +0 -54
  451. package/src/check/job-shapes.ts +0 -273
  452. package/src/check/link-flag-tests.ts +0 -130
  453. package/src/check/live-api.ts +0 -137
  454. package/src/check/mail-api.ts +0 -67
  455. package/src/check/one-state-api.ts +0 -357
  456. package/src/check/pages-options.ts +0 -35
  457. package/src/check/rate-enforce.ts +0 -53
  458. package/src/check/refusal-calls.ts +0 -185
  459. package/src/check/retired-lints.ts +0 -49
  460. package/src/check/route-keys.ts +0 -166
  461. package/src/check/secret-keys.ts +0 -83
  462. package/src/check/socket-frames.ts +0 -102
  463. package/src/check/source-readers.ts +0 -257
  464. package/src/check/store-ms.ts +0 -72
  465. package/src/check/store-names.ts +0 -88
  466. package/src/check/test-helpers.ts +0 -98
  467. package/src/check/ttl-names.ts +0 -142
  468. package/src/compiler/deprecated-ai-labels.ts +0 -97
  469. package/src/compiler/deprecated-ai-links.ts +0 -63
  470. package/src/compiler/deprecated-allow.ts +0 -50
  471. package/src/compiler/deprecated-auth-lints.ts +0 -14
  472. package/src/compiler/deprecated-auth-signed.ts +0 -29
  473. package/src/compiler/deprecated-children.ts +0 -66
  474. package/src/compiler/deprecated-image.ts +0 -116
  475. package/src/compiler/deprecated-island.ts +0 -155
  476. package/src/compiler/deprecated-lints-1-105.ts +0 -41
  477. package/src/compiler/deprecated-page.ts +0 -125
  478. package/src/compiler/deprecated-parts.ts +0 -22
  479. package/src/compiler/deprecated-typed-lints.ts +0 -23
  480. package/src/compiler/deprecated-ui-callbacks.ts +0 -66
  481. package/src/compiler/deprecated-ui-input.ts +0 -97
  482. package/src/compiler/deprecated-ui-items.ts +0 -47
  483. package/src/compiler/old-parts.ts +0 -84
  484. package/src/runtime/mount.compat.ts +0 -8
  485. package/src/server/moved-exports.ts +0 -17
  486. package/types/check/action-readers.d.ts +0 -3
  487. package/types/check/action-readers.d.ts.map +0 -1
  488. package/types/check/action-type.d.ts +0 -3
  489. package/types/check/action-type.d.ts.map +0 -1
  490. package/types/check/ai-language.d.ts +0 -3
  491. package/types/check/ai-language.d.ts.map +0 -1
  492. package/types/check/app-hooks.d.ts +0 -3
  493. package/types/check/app-hooks.d.ts.map +0 -1
  494. package/types/check/auth-methods.d.ts +0 -3
  495. package/types/check/auth-methods.d.ts.map +0 -1
  496. package/types/check/auth-rate-limits.d.ts +0 -3
  497. package/types/check/auth-rate-limits.d.ts.map +0 -1
  498. package/types/check/call-result.d.ts +0 -7
  499. package/types/check/call-result.d.ts.map +0 -1
  500. package/types/check/client-keys.d.ts +0 -3
  501. package/types/check/client-keys.d.ts.map +0 -1
  502. package/types/check/cms-options.d.ts +0 -3
  503. package/types/check/cms-options.d.ts.map +0 -1
  504. package/types/check/config-groups.d.ts +0 -3
  505. package/types/check/config-groups.d.ts.map +0 -1
  506. package/types/check/config-switches.d.ts +0 -3
  507. package/types/check/config-switches.d.ts.map +0 -1
  508. package/types/check/context-import.d.ts +0 -3
  509. package/types/check/context-import.d.ts.map +0 -1
  510. package/types/check/env-files.d.ts +0 -3
  511. package/types/check/env-files.d.ts.map +0 -1
  512. package/types/check/format-duration.d.ts +0 -5
  513. package/types/check/format-duration.d.ts.map +0 -1
  514. package/types/check/guard-options.d.ts +0 -3
  515. package/types/check/guard-options.d.ts.map +0 -1
  516. package/types/check/handler-events.d.ts +0 -9
  517. package/types/check/handler-events.d.ts.map +0 -1
  518. package/types/check/hook-context.d.ts +0 -3
  519. package/types/check/hook-context.d.ts.map +0 -1
  520. package/types/check/hook-names.d.ts +0 -3
  521. package/types/check/hook-names.d.ts.map +0 -1
  522. package/types/check/i18n-keys.d.ts +0 -3
  523. package/types/check/i18n-keys.d.ts.map +0 -1
  524. package/types/check/images-keys.d.ts +0 -3
  525. package/types/check/images-keys.d.ts.map +0 -1
  526. package/types/check/job-shapes.d.ts +0 -6
  527. package/types/check/job-shapes.d.ts.map +0 -1
  528. package/types/check/link-flag-tests.d.ts +0 -4
  529. package/types/check/link-flag-tests.d.ts.map +0 -1
  530. package/types/check/live-api.d.ts +0 -3
  531. package/types/check/live-api.d.ts.map +0 -1
  532. package/types/check/mail-api.d.ts +0 -3
  533. package/types/check/mail-api.d.ts.map +0 -1
  534. package/types/check/one-state-api.d.ts +0 -9
  535. package/types/check/one-state-api.d.ts.map +0 -1
  536. package/types/check/pages-options.d.ts +0 -3
  537. package/types/check/pages-options.d.ts.map +0 -1
  538. package/types/check/rate-enforce.d.ts +0 -3
  539. package/types/check/rate-enforce.d.ts.map +0 -1
  540. package/types/check/refusal-calls.d.ts +0 -3
  541. package/types/check/refusal-calls.d.ts.map +0 -1
  542. package/types/check/retired-lints.d.ts +0 -3
  543. package/types/check/retired-lints.d.ts.map +0 -1
  544. package/types/check/route-keys.d.ts +0 -3
  545. package/types/check/route-keys.d.ts.map +0 -1
  546. package/types/check/secret-keys.d.ts +0 -3
  547. package/types/check/secret-keys.d.ts.map +0 -1
  548. package/types/check/socket-frames.d.ts +0 -3
  549. package/types/check/socket-frames.d.ts.map +0 -1
  550. package/types/check/source-readers.d.ts +0 -3
  551. package/types/check/source-readers.d.ts.map +0 -1
  552. package/types/check/store-ms.d.ts +0 -3
  553. package/types/check/store-ms.d.ts.map +0 -1
  554. package/types/check/store-names.d.ts +0 -3
  555. package/types/check/store-names.d.ts.map +0 -1
  556. package/types/check/test-helpers.d.ts +0 -3
  557. package/types/check/test-helpers.d.ts.map +0 -1
  558. package/types/check/ttl-names.d.ts +0 -3
  559. package/types/check/ttl-names.d.ts.map +0 -1
  560. package/types/compiler/deprecated-ai-labels.d.ts +0 -5
  561. package/types/compiler/deprecated-ai-labels.d.ts.map +0 -1
  562. package/types/compiler/deprecated-ai-links.d.ts +0 -5
  563. package/types/compiler/deprecated-ai-links.d.ts.map +0 -1
  564. package/types/compiler/deprecated-allow.d.ts +0 -5
  565. package/types/compiler/deprecated-allow.d.ts.map +0 -1
  566. package/types/compiler/deprecated-auth-lints.d.ts +0 -12
  567. package/types/compiler/deprecated-auth-lints.d.ts.map +0 -1
  568. package/types/compiler/deprecated-auth-signed.d.ts +0 -5
  569. package/types/compiler/deprecated-auth-signed.d.ts.map +0 -1
  570. package/types/compiler/deprecated-children.d.ts +0 -4
  571. package/types/compiler/deprecated-children.d.ts.map +0 -1
  572. package/types/compiler/deprecated-image.d.ts +0 -5
  573. package/types/compiler/deprecated-image.d.ts.map +0 -1
  574. package/types/compiler/deprecated-island.d.ts +0 -9
  575. package/types/compiler/deprecated-island.d.ts.map +0 -1
  576. package/types/compiler/deprecated-lints-1-105.d.ts +0 -39
  577. package/types/compiler/deprecated-lints-1-105.d.ts.map +0 -1
  578. package/types/compiler/deprecated-page.d.ts +0 -4
  579. package/types/compiler/deprecated-page.d.ts.map +0 -1
  580. package/types/compiler/deprecated-parts.d.ts +0 -3
  581. package/types/compiler/deprecated-parts.d.ts.map +0 -1
  582. package/types/compiler/deprecated-typed-lints.d.ts +0 -21
  583. package/types/compiler/deprecated-typed-lints.d.ts.map +0 -1
  584. package/types/compiler/deprecated-ui-callbacks.d.ts +0 -5
  585. package/types/compiler/deprecated-ui-callbacks.d.ts.map +0 -1
  586. package/types/compiler/deprecated-ui-input.d.ts +0 -5
  587. package/types/compiler/deprecated-ui-input.d.ts.map +0 -1
  588. package/types/compiler/deprecated-ui-items.d.ts +0 -5
  589. package/types/compiler/deprecated-ui-items.d.ts.map +0 -1
  590. package/types/compiler/old-parts.d.ts +0 -9
  591. package/types/compiler/old-parts.d.ts.map +0 -1
  592. package/types/runtime/mount.compat.d.ts +0 -7
  593. package/types/runtime/mount.compat.d.ts.map +0 -1
  594. package/types/server/moved-exports.d.ts +0 -12
  595. package/types/server/moved-exports.d.ts.map +0 -1
@@ -138,7 +138,7 @@ export const ERRORS = {
138
138
  },
139
139
  'client-route-fence': {
140
140
  group: 'compile',
141
- summary: 'A page, layout or special page declaring `island({ render: \'client\' })` or with a `--- client` fence: they render on the server.',
141
+ summary: 'A page, layout or special page declaring `island({ render: \'client\' })`: they render on the server.',
142
142
  fix: { file: 'llms/islands.md', heading: 'Islands' },
143
143
  },
144
144
  'server-import-in-island': {
@@ -228,7 +228,7 @@ export const ERRORS = {
228
228
  },
229
229
  'locales-invalid': {
230
230
  group: 'build',
231
- summary: 'An `i18n` config that does not hold together: no locales, a tag that is none, a default outside the locales, domains and `prefixDefault` together, `paths` naming a page that does not exist, a catalog that exports no messages or not as `defineMessages`, or `writeDraftMessages` given a locale the config does not translate.',
231
+ summary: 'An `i18n` config that does not hold together: no locales, a tag that is none, a default outside the locales, `paths` naming a page that does not exist, a catalog that exports no messages or not as `defineMessages`, or `writeDraftMessages` given a locale the config does not translate.',
232
232
  fix: { file: 'llms/locales.md', heading: 'Configuring locales' },
233
233
  },
234
234
  'font-invalid': {
@@ -508,125 +508,6 @@ export function asyncReplies(fence: ParsedFence): Diagnostic[] {
508
508
  return diagnostics
509
509
  }
510
510
 
511
- // The name an action handler reads `fail` by: `ctx.fail` for a `ctx` parameter, `fail` for a destructured one.
512
- function failReader(ctx: Node | undefined): ((call: NodeOfType<'CallExpression'>) => boolean) | undefined {
513
- if (ctx?.type === 'Identifier') {
514
- const name = ctx.name
515
-
516
- return call => call.callee.type === 'MemberExpression' && !call.callee.computed && call.callee.object.type === 'Identifier' && call.callee.object.name === name && call.callee.property.type === 'Identifier' && call.callee.property.name === 'fail'
517
- }
518
-
519
- if (ctx?.type !== 'ObjectPattern')
520
- return undefined
521
-
522
- for (const property of ctx.properties) {
523
- if (isPlainProperty(property) && !property.computed && property.key.type === 'Identifier' && property.key.name === 'fail' && property.value.type === 'Identifier') {
524
- const local = property.value.name
525
-
526
- return call => call.callee.type === 'Identifier' && call.callee.name === local
527
- }
528
- }
529
-
530
- return undefined
531
- }
532
-
533
- // The `fail` calls an expression statement drops: the call itself, awaited, or on either side of `&&`, `||`, `??` and a ternary.
534
- function droppedFails(node: Node, reads: (call: NodeOfType<'CallExpression'>) => boolean): NodeOfType<'CallExpression'>[] {
535
- if (node.type === 'CallExpression')
536
- return reads(node) ? [node] : []
537
-
538
- if (node.type === 'AwaitExpression')
539
- return droppedFails(node.argument, reads)
540
-
541
- if (node.type === 'LogicalExpression')
542
- return [...droppedFails(node.left, reads), ...droppedFails(node.right, reads)]
543
-
544
- if (node.type === 'ConditionalExpression')
545
- return [...droppedFails(node.consequent, reads), ...droppedFails(node.alternate, reads)]
546
-
547
- return node.type === 'ParenthesizedExpression' || node.type === 'TSNonNullExpression' ? droppedFails(node.expression, reads) : []
548
- }
549
-
550
- // The names `action` is called by: the one `kay` exports, as imported or not yet, and the aliases imported from it; none when another module's or a local one takes the name.
551
- function actionNames(fence: ParsedFence): Set<string> {
552
- const names = new Set(['action'])
553
-
554
- for (const node of fence.ast.body) {
555
- if (node.type === 'ImportDeclaration') {
556
- for (const specifier of node.specifiers) {
557
- const name = specifier.type === 'ImportSpecifier' ? specifier.imported : undefined
558
- const imported = name?.type === 'Identifier' ? name.name : name?.value
559
-
560
- if (node.source.value === 'kay' && imported === 'action')
561
- names.add(specifier.local.name)
562
- else if (specifier.local.name === 'action')
563
- names.delete('action')
564
- }
565
- }
566
- else if ((node.type === 'FunctionDeclaration' && node.id?.name === 'action') || (node.type === 'VariableDeclaration' && node.declarations.some(declaration => patternNames(declaration.id).includes('action')))) {
567
- names.delete('action')
568
- }
569
- }
570
-
571
- return names
572
- }
573
-
574
- // A `ctx.fail(...)` statement in an action's handler: `fail` returns the failure, where `deny`, `notFound` and `redirect` throw, so a statement not returned does nothing and the handler carries on.
575
- export function unreturnedFails(fence: ParsedFence): Diagnostic[] {
576
- if (!fence.code.includes('fail(') || !fence.code.includes('action'))
577
- return []
578
-
579
- const diagnostics: Diagnostic[] = []
580
- const names = actionNames(fence)
581
- const seen = new Set<number>()
582
-
583
- eachNode(fence.ast, (node) => {
584
- if (node.type !== 'CallExpression' || node.callee.type !== 'Identifier' || !names.has(node.callee.name))
585
- return
586
-
587
- const handler = node.arguments.findIndex(argument => argument.type === 'ArrowFunctionExpression' || argument.type === 'FunctionExpression')
588
- const fn = node.arguments[handler]
589
-
590
- if (!fn || !isFunction(fn) || !fn.body || fn.body.type !== 'BlockStatement')
591
- return
592
-
593
- const reads = failReader(fn.params[handler === 0 ? 0 : 1])
594
-
595
- if (!reads)
596
- return
597
-
598
- eachNode(fn.body, (inner) => {
599
- if (isFunction(inner))
600
- return false
601
-
602
- if (inner.type === 'ExpressionStatement') {
603
- const { expression } = inner
604
- const awaited = expression.type === 'AwaitExpression' ? expression.argument : expression
605
- const direct = awaited.type === 'CallExpression' ? awaited : undefined
606
-
607
- for (const call of droppedFails(inner.expression, reads)) {
608
- if (seen.has(call.start))
609
- continue
610
-
611
- seen.add(call.start)
612
- diagnostics.push({
613
- ...fence.shift(call),
614
- code: 'unreturned-fail',
615
- message: 'This `fail()` is not returned, so it does nothing and the handler carries on',
616
- note: '`fail` returns the failure the action answers with, where `deny`, `notFound` and `redirect` throw',
617
- help: 'write `return ctx.fail(...)`',
618
- fixes: call === direct ? [{ title: 'Return it', edits: [{ start: fence.offset + inner.start, end: fence.offset + inner.start, text: 'return ' }], safe: true }] : [],
619
- })
620
- }
621
- }
622
-
623
- return true
624
- })
625
- })
626
-
627
- return diagnostics
628
- }
629
-
630
511
  // A destructured prop read into a top-level `const` or `let` that a function or the template reads later: the declaration runs once, when the component is created, so the value keeps the prop's first value after the parent changes it.
631
512
  // A prop read as the test of a condition, as an argument of a call or `new`, as a write target or inside a class is left alone: those choose or build something once, and a name declared again anywhere in the script is left alone too.
632
513
  export function onceReadProps(fence: ParsedFence, props: PropsDeclaration | undefined, templateNames: readonly string[]): Diagnostic[] {
@@ -756,7 +637,7 @@ export function missingCaptchas(fence: ParsedFence): Diagnostic[] {
756
637
  // The checks a plain module takes, parsed only when one of them may find something.
757
638
  // A module the browser bundle reaches (`browser`) is checked for the names the browser's entries lack as well.
758
639
  export function moduleChecks(source: string, browser = false): Diagnostic[] {
759
- if (!CSS_BINDING.test(source) && !(browser && source.includes('kay/cache')) && !(source.includes(AI_PACKAGE) && source.includes('async')) && !source.includes('redirect(') && !source.includes('fail(') && !CAPTCHA_CALLS.keys().some(name => source.includes(name)))
640
+ if (!CSS_BINDING.test(source) && !(browser && source.includes('kay/cache')) && !(source.includes(AI_PACKAGE) && source.includes('async')) && !source.includes('redirect(') && !CAPTCHA_CALLS.keys().some(name => source.includes(name)))
760
641
  return []
761
642
 
762
643
  const whole = { start: 0, end: source.length }
@@ -775,5 +656,5 @@ export function moduleChecks(source: string, browser = false): Diagnostic[] {
775
656
  }
776
657
 
777
658
  function checksOf(module: ParsedFence, browser: boolean): Diagnostic[] {
778
- return [...cssImportsWithoutText(module), ...asyncReplies(module), ...openRedirects(module), ...missingCaptchas(module), ...unreturnedFails(module), ...browser ? serverOnlyImports(module) : []]
659
+ return [...cssImportsWithoutText(module), ...asyncReplies(module), ...openRedirects(module), ...missingCaptchas(module), ...browser ? serverOnlyImports(module) : []]
779
660
  }
@@ -0,0 +1,83 @@
1
+ import type { Attribute, ElementNode, NamedAttribute, PartFacts } from './ast'
2
+ import type { ClassItem } from './class-items'
3
+ import type { CodeBuilder } from './mapping'
4
+ import { handedParts, partsOf } from './ast'
5
+ import { helperName } from './markup'
6
+ import { PROPS } from './names'
7
+
8
+ type ExpressionAttribute = Extract<NamedAttribute, { kind: 'expression' }>
9
+
10
+ // The `parts` a component call writes and the spreads, whose `parts` a call handing parts on lays under its own, as the called component would otherwise lose them to the hand-off.
11
+ export function writtenParts(element: ElementNode, source: string): Attribute[] {
12
+ const hand = element.attributes.find((one): one is ExpressionAttribute => one.kind === 'expression' && source.slice(one.name.start, one.name.end) === 'parts')
13
+
14
+ return [...element.attributes.filter(one => one.kind === 'spread'), hand].filter(attribute => attribute !== undefined)
15
+ }
16
+
17
+ // Whether a component call hands a part of this component on without being handed parts itself: it writes its `class` and `parts` as one source, `partProps`.
18
+ export function writesTogether(element: ElementNode, source: string, facts: PartFacts | undefined): boolean {
19
+ return element.component && partsOf(element, source, facts).length > 0 && handedParts(element, source, facts).length === 0
20
+ }
21
+
22
+ // What a part handed on to a component adds to the class list: its recipe's classes and the caller's entry for it, which `partHanded` makes the part's value.
23
+ export function handedItem(b: CodeBuilder, part: string, recipe: readonly (() => void)[]): ClassItem {
24
+ return {
25
+ emit: () => {
26
+ b.add(`${helperName('partHanded')}(${JSON.stringify(part)}, [`)
27
+
28
+ for (const emit of recipe) {
29
+ emit()
30
+ b.add(', ')
31
+ }
32
+
33
+ b.add(`${helperName('partClass')}(${PROPS}, ${JSON.stringify(part)})])`)
34
+ },
35
+ }
36
+ }
37
+
38
+ // What opens the list of classes of an element: an array, or on a component call the helper merging it, which is `handParts` for the `parts` of a call handing parts on and `partProps` for the `class` and `parts` of a call written as one source.
39
+ export function openClassList(b: CodeBuilder, component: boolean, handing: readonly Attribute[] | undefined, together: boolean): void {
40
+ if (together) {
41
+ b.add(`${helperName('partProps')}(() => [[`)
42
+
43
+ return
44
+ }
45
+
46
+ b.add(component ? `${helperName(handing ? 'handParts' : 'componentClass')}([` : '[')
47
+ }
48
+
49
+ // What closes the `handParts` of a call: the `parts` it writes, the spreads' under them.
50
+ export function closeHandParts(b: CodeBuilder, component: boolean, written: readonly Attribute[] | undefined, together: boolean): void {
51
+ b.add(component && !written && !together ? '])' : ']')
52
+
53
+ const given = written?.filter(attribute => attribute.kind === 'expression' || attribute.kind === 'spread') ?? []
54
+ const emit = (attribute: (typeof given)[number]) => {
55
+ if (attribute.kind === 'spread')
56
+ b.add('((').addSource(attribute.expression).add(') as unknown as { parts?: unknown }).parts')
57
+ else if (attribute.kind === 'expression')
58
+ b.add('(').addSource(attribute.expression).add(')')
59
+ }
60
+
61
+ if (given.length === 1) {
62
+ b.add(', ')
63
+ emit(given[0]!)
64
+ }
65
+ else if (given.length > 1) {
66
+ b.add(', { ')
67
+
68
+ for (const [index, attribute] of given.entries()) {
69
+ b.add(index === 0 ? '...' : ', ...')
70
+ emit(attribute)
71
+ }
72
+
73
+ b.add(' }')
74
+ }
75
+
76
+ if (written)
77
+ b.add(together ? '])' : ')')
78
+ }
79
+
80
+ // Whether an attribute of a call handing parts on is one it writes itself, as `parts`: the `parts` and the spreads.
81
+ export function handsEntry(element: ElementNode, source: string, attribute: NamedAttribute, hands: boolean): boolean {
82
+ return hands && writtenParts(element, source).includes(attribute)
83
+ }
@@ -2,10 +2,10 @@ import type { AwaitAlert } from './names'
2
2
  import { helperName } from './markup'
3
3
 
4
4
  // The `kay/html` helpers static server output calls, each imported under a `Kay` name.
5
- const 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']
5
+ const HTML_HELPERS = ['attempt', 'attribute', 'checkedMarkup', 'child', 'className', 'component', 'componentClass', 'currentPage', 'dynamic', 'element', 'errorParagraph', 'fieldDescribed', 'formConstraints', 'formKey', 'formOptions', 'formType', 'handParts', 'head', 'html', 'imageAttributes', 'innerMarkup', 'leadingNewline', 'linkHref', 'localHref', 'loop', 'memo', 'merge', 'nonEmptyAttribute', 'omit', 'outsideLink', 'partClass', 'partHanded', 'partProps', 'raw', 'rawData', 'rawTyped', 'refillOptions', 'schemaFill', 'selectOptions', 'serverIsland', 'show', 'spreadAttributes', 'spreadWith', 'style', 'untrack']
6
6
 
7
7
  // The `kay/dom` helpers browser output calls, each imported under a `Kay` name.
8
- const 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']
8
+ const DOM_HELPERS = ['append', 'attribute', 'branches', 'checkedMarkup', 'choose', 'close', 'component', 'componentClass', 'effect', 'errorParagraph', 'fragment', 'handParts', 'holdSubmits', 'insert', 'listen', 'listenSubmit', 'listenSubmitWith', 'listenWith', 'markers', 'memo', 'merge', 'omit', 'outside', 'part', 'partClass', 'partHanded', 'partProps', 'property', 'ref', 'setClass', 'setStyle', 'spreadAttributes', 'spreadWith', 'template', 'text', 'transition', 'untrack']
9
9
  // The helpers in modules of their own, as their runtimes weigh on a page whose islands use none of them: the module of each is only loaded by a page with an island that compiles to it.
10
10
  const 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']]] as const
11
11
 
@@ -29,8 +29,6 @@ export interface ImageOptionAttributes {
29
29
 
30
30
  // What an `img` with an imported `src` takes beside `sizes`, `width` and `height`: the shape it is cut to, the quality of its variants, and whether it shows its color until it loads. Read by the source and never written.
31
31
  export const IMAGE_OPTIONS = new Set(['aspect', 'quality', 'placeholder'])
32
- // The attribute an `img` read before 1.105 for leaving out the color it shows until it loads, `placeholder={false}` since.
33
- export const NO_PLACEHOLDER = 'no-placeholder'
34
32
 
35
33
  // The attributes an `img` with an imported `src` takes besides `sizes`, and whether it shows its color until it loads.
36
34
  export function imageOptions(element: ElementNode, source: Source): { options: ImageOptionAttributes, colour: boolean } {
@@ -38,7 +36,7 @@ export function imageOptions(element: ElementNode, source: Source): { options: I
38
36
  const options = { aspect: find('aspect'), quality: find('quality'), placeholder: find('placeholder') }
39
37
  const written = (name: string) => element.attributes.some(attribute => attribute.kind !== 'spread' && source(attribute.name) === name)
40
38
 
41
- return { options, colour: !written('style') && !written(NO_PLACEHOLDER) && !placeholderOff(options.placeholder, source) }
39
+ return { options, colour: !written('style') && !placeholderOff(options.placeholder, source) }
42
40
  }
43
41
 
44
42
  // Whether the attribute is `placeholder={false}`, the one form kay reads while compiling, so the server leaves the color out.
@@ -15,17 +15,13 @@ import { actionOf, drawIcons, elementsIn, INTERACTIVE_ATTRIBUTE, SERVER_IN_ISLAN
15
15
  import { browserReads } from './browser'
16
16
  import { wrapActionButtons } from './button-forms'
17
17
  import { generate, isInteractive, islandCause, lineOf } from './codegen'
18
- import { retiredAllowComments } from './deprecated-allow'
19
- import { deprecatedChildrenProp } from './deprecated-children'
20
- import { deprecatedIslandAttributes, deprecatedIslandForms, islandProblems } from './deprecated-island'
21
- import { deprecatedPageSettings } from './deprecated-page'
22
- import { deprecatedPartsClass } from './deprecated-parts'
23
- import { asyncReplies, cssImportsWithoutText, missingCaptchas, onceReadProps, separatePageSettings, serverOnlyImports, unboundedFields, unreturnedFails } from './fence-checks'
18
+ import { asyncReplies, cssImportsWithoutText, missingCaptchas, onceReadProps, separatePageSettings, serverOnlyImports, unboundedFields } from './fence-checks'
24
19
  import { openRedirects } from './fence-redirects'
25
20
  import { cwd, scopeStorage } from './host'
26
- import { ignoredIslandExport, interactiveProps, islandMessages, malformedInteractive, withAlertKeys } from './island-arguments'
21
+ import { ignoredIslandExport, islandMessages, withAlertKeys } from './island-arguments'
27
22
  import { describeCause } from './island-cause'
28
23
  import { markerMismatch } from './island-marker'
24
+ import { islandProblems } from './island-problems'
29
25
  import { lazyImportsOf } from './lazy-imports'
30
26
  import { linkFlags } from './link-flags'
31
27
  import { applyLints, templateLints } from './lints'
@@ -38,8 +34,9 @@ import { scopeAttribute } from './scoped-style'
38
34
  import { analyzeScript, analyzeServer } from './script'
39
35
  import { serialAwaits } from './serial-awaits'
40
36
  import { serverImportReads } from './server-imports'
37
+ import { signalFromProps } from './signal-from-prop'
41
38
  import { STATUS_PAGE_FILES } from './status-pages'
42
- import { outerReads, templateWords } from './template-reads'
39
+ import { outerReads, templateWords, templateWrites } from './template-reads'
43
40
  import { ISLAND_TWIN } from './twin'
44
41
  import { unownedEffects } from './unowned-effects'
45
42
  import { validate } from './validate'
@@ -83,7 +80,7 @@ export interface CompileOptions {
83
80
  twinBuild?: boolean | undefined
84
81
  // The props the component's call sites write, when all are known: the `...rest` of its props leaves out only these of the ones it declares.
85
82
  writtenProps?: ReadonlySet<string> | undefined
86
- // Whether the file is a page of a routes directory (`isPageFile`), which nothing renders inside an island, so a page without a server fence reads its loops as static as the build does, is refused `--- client` and `--- island`, and is no island by its pin; `false` says it is a component, where a root `@block` is refused.
83
+ // Whether the file is a page of a routes directory (`isPageFile`), which nothing renders inside an island, so a page without a server fence reads its loops as static as the build does, is refused `island()`, and is no island by its pin; `false` says it is a component, where a root `@block` is refused.
87
84
  page?: boolean | undefined
88
85
  // Whether the file is known to be a component, which has no `--- server` fence: a library checked on its own has pages no routes directory names, so only a caller knowing its routes says so.
89
86
  component?: boolean | undefined
@@ -91,7 +88,7 @@ export interface CompileOptions {
91
88
  lints?: LintLevels | undefined
92
89
  // Type checking only: the types alone, for a file whose problems nothing reads, so the ones only `kay check` reports are not looked for.
93
90
  typesOnly?: boolean | undefined
94
- // Renders in the browser only, as `--- client` does: set when a package the component imports cannot load on the server.
91
+ // Renders in the browser only, as `island({ render: 'client' })` does: set when a package the component imports cannot load on the server.
95
92
  clientOnly?: boolean | undefined
96
93
  // Type-checking a static component only islands render: its children render inline with it, so the props it passes them are not serialized.
97
94
  insideIsland?: boolean | undefined
@@ -182,9 +179,9 @@ function browserCause(file: KayFile, script: ScriptAnalysis, value: ReturnType<t
182
179
  return value === undefined || binding === undefined ? undefined : { kind: value.kind, name: value.local, span: binding.span, line: lineOf(file.source, binding.span.start) }
183
180
  }
184
181
 
185
- // The cause with the props the component's `island` export lists as making a use interactive, when it lists some: a client-only component and one following a live or persisted value are islands in every use.
182
+ // The cause with the props the component's `island()` lists as making a use interactive, when it lists some: a client-only component and one following a live or persisted value are islands in every use.
186
183
  function withInteractive(cause: IslandCause | undefined, script: ScriptAnalysis): IslandCause | undefined {
187
- const interactive = interactiveProps(script)
184
+ const interactive = script.island?.interactive
188
185
 
189
186
  return cause !== undefined && interactive !== undefined && cause.kind !== 'client' && cause.kind !== 'live' && cause.kind !== 'persisted' ? { ...cause, interactive } : cause
190
187
  }
@@ -204,12 +201,12 @@ function staticPin(span: Span, cause: IslandCause): Diagnostic {
204
201
  return { ...span, code: 'static-pin', message: `This component is declared \`island({ render: 'static' })\`, and is an island: ${describeCause(cause)}`, note: 'it needs the browser, so it hydrates there', help: 'take that out of the component, or declare it `island()`' }
205
202
  }
206
203
 
207
- // A page without a server fence that is an island for a handler, a `kay` value or a live or persisted import: a page renders once, so a component should hold what needs the browser. It works until 1.108.
208
- function deprecatedPageIsland(page: boolean, route: boolean, client: boolean, check: boolean | undefined, raw: IslandCause | undefined, cause: IslandCause | undefined): Diagnostic[] {
204
+ // A page without a server fence that is an island for a handler, a `kay` value or a live or persisted import: a page renders once, so a component should hold what needs the browser.
205
+ function pageIsland(page: boolean, route: boolean, client: boolean, check: boolean | undefined, raw: IslandCause | undefined, cause: IslandCause | undefined): Diagnostic[] {
209
206
  if (!page || route || client || check !== true || raw === undefined || cause === undefined)
210
207
  return []
211
208
 
212
- return [{ ...raw.span, code: 'deprecated-page-island', checkOnly: true, message: `A page is never an island since 1.105, and this one is for ${describeCause(cause)}`, note: 'a page renders once on the server, so nothing in it should run in the browser', help: 'move what needs the browser into a component of its own and render it from the page' }]
209
+ return [{ ...raw.span, code: 'page-island', checkOnly: true, message: `A page is never an island, and this one is for ${describeCause(cause)}`, note: 'a page renders once on the server, so nothing in it should run in the browser', help: 'move what needs the browser into a component of its own and render it from the page' }]
213
210
  }
214
211
 
215
212
  // What the server fence declares for the template: its data and its exports, which the script reads as declared rather than as kay values to import.
@@ -219,9 +216,9 @@ function serverNames(server: ServerAnalysis | undefined): string[] | undefined {
219
216
 
220
217
  // What a component's script and template say of its role in the browser, from one analysis.
221
218
  interface Role {
222
- // A `--- client` component or an interactive one, an island whatever its file.
219
+ // A client-only component or an interactive one, an island whatever its file.
223
220
  always: boolean
224
- // A `--- island` fence: an island unless the file is a page, a layout or a special page, which is never one by its pin.
221
+ // An `island()` pin: an island unless the file is a page, a layout or a special page, which is never one by its pin.
225
222
  pinned: boolean
226
223
  // It imports a live or persisted value, which makes a file that is not a layout, a special page or one with a server fence an island.
227
224
  live: boolean
@@ -263,7 +260,7 @@ function roleOf(original: string, imported: ImportedSignals | undefined, page: b
263
260
  }
264
261
 
265
262
  // Whether a component renders as an island of its own, as compileKay decides it, without generating its code.
266
- // `page` says the file is a page of the routes directory (`isPageFile`), which its `--- island` fence does not make an island.
263
+ // `page` says the file is a page of the routes directory (`isPageFile`), which its `island()` declaration does not make an island.
267
264
  export function rendersAsIsland(original: string, imported?: ImportedSignals, page = false): boolean {
268
265
  const { always, live, pinned, server } = roleOf(original, imported, page)
269
266
 
@@ -291,7 +288,7 @@ export function onceReadChecks(original: string): Diagnostic[] {
291
288
  const server = analyzeServer(source, file.server)
292
289
  const script = analyzeScript(source, file.script, serverNames(server), file.module)
293
290
 
294
- return script.fence ? onceReadProps(script.fence, script.props, templateWords(file)) : []
291
+ return script.fence ? [...onceReadProps(script.fence, script.props, templateWords(file)), ...signalFromProps(script.fence, script.props, templateWrites(file))] : []
295
292
  }
296
293
 
297
294
  const FAILED_FUNCTION = /^function KayFailed\(/m
@@ -356,7 +353,7 @@ export function compileKay(original: string, filename: string, options: CompileO
356
353
  ...coded(server ? separatePageSettings(source, server) : [], 'page-settings-invalid'),
357
354
  ...validate(file, script, server, generateOptions),
358
355
  ...coded(unparsed ? [] : found.diagnostics, 'signal-misuse'),
359
- ...deprecatedPageIsland(pageFile, routeFile, client, options.check, rawCause, cause),
356
+ ...pageIsland(pageFile, routeFile, client, options.check, rawCause, cause),
360
357
  ...coded(pin?.kind === 'static' && cause !== undefined && rawCause !== undefined && !routeFile && island !== undefined ? [staticPin(rawCause.span, { ...cause, interactive: undefined })] : [], 'static-pin'),
361
358
  ]
362
359
 
@@ -369,6 +366,9 @@ export function compileKay(original: string, filename: string, options: CompileO
369
366
  // Type checking only, so a page still runs while it is fixed, and fails there in development naming the same fixes.
370
367
  const serverData = server?.data.map(data => data.name) ?? []
371
368
 
369
+ // The `island` export of the `--- module` fence read before 1.109 is an error in every output, as it declares nothing now.
370
+ diagnostics.push(...ignoredIslandExport(script))
371
+
372
372
  if (checked && !client)
373
373
  diagnostics.push(...coded(browserReads(file, island !== undefined, serverData, routeFile), 'browser-only-read'), ...coded(serverImportReads(file, script, server, island !== undefined), 'server-import-in-island'))
374
374
 
@@ -379,12 +379,12 @@ export function compileKay(original: string, filename: string, options: CompileO
379
379
  const broken = diagnostics.some(diagnostic => !diagnostic.checkOnly)
380
380
 
381
381
  if (checked) {
382
- const fenceLints = [script.fence, script.moduleFence, server?.fence].flatMap(fence => fence ? [...cssImportsWithoutText(fence), ...asyncReplies(fence), ...openRedirects(fence), ...missingCaptchas(fence), ...unreturnedFails(fence)] : [])
382
+ const fenceLints = [script.fence, script.moduleFence, server?.fence].flatMap(fence => fence ? [...cssImportsWithoutText(fence), ...asyncReplies(fence), ...openRedirects(fence), ...missingCaptchas(fence)] : [])
383
383
  // The script runs in the browser as an island's and in a component only islands render.
384
384
  const browserScript = (island !== undefined || options.insideIsland === true) && !routeFile ? scriptFences(script) : []
385
385
  const unusedLints = broken ? [] : [...unreadNames(source, file.template, script, server, found.findings), ...constantSignals(source, [file.script, file.module], found.findings)]
386
386
 
387
- 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))
387
+ diagnostics.push(...unboundedFields(server), ...fenceLints, ...serialAwaits(server), ...browserScript.flatMap(fence => serverOnlyImports(fence)), ...browserScript.includes(script.fence!) ? [...onceReadProps(script.fence!, script.props, templateWords(file)), ...signalFromProps(script.fence!, script.props, templateWrites(file))] : [], ...unusedLints, ...templateLints(file), ...linkFlags(file))
388
388
  }
389
389
 
390
390
  if (checked && pin !== undefined)
@@ -537,7 +537,7 @@ function takeBlock(file: KayFile, filename: string, options: CompileOptions, scr
537
537
  const at = file.source.slice(block.start, block.end).search(new RegExp(`(?<![\\w$])${name.replaceAll('$', '\\$')}(?![\\w$])`, 'g'))
538
538
  const start = at < 0 ? block.name.start : block.start + at
539
539
 
540
- file.diagnostics.push({ start, end: at < 0 ? block.name.end : start + name.length, code: 'fallback-invalid', message: `\`@${which}\` of ${which === 'failed' ? 'a' : 'a `--- client`'} component reads \`${name}\`, which the server does not have`, note: 'the server renders it without running the script', help: 'write static markup, or import what it needs' })
540
+ file.diagnostics.push({ start, end: at < 0 ? block.name.end : start + name.length, code: 'fallback-invalid', message: `\`@${which}\` of ${which === 'failed' ? 'a' : 'a client-only'} component reads \`${name}\`, which the server does not have`, note: 'the server renders it without running the script', help: 'write static markup, or import what it needs' })
541
541
  }
542
542
 
543
543
  return { code: compiled.tsx.replace(FALLBACK_COMPONENT, which === 'failed' ? 'function KayFailed(' : 'function KayFallback('), classes: compiled.classes }
@@ -1,4 +1,5 @@
1
- import type { Diagnostic, Span } from './ast'
1
+ import type { Diagnostic } from './ast'
2
+ import type { IslandDeclaration } from './island-declaration'
2
3
  import type { AwaitAlert } from './names'
3
4
  import type { ScriptAnalysis } from './script'
4
5
  import { AWAIT_FAILED_KEY } from '../runtime/await-failed'
@@ -21,109 +22,22 @@ export function withAlertKeys(source: string, alert: AwaitAlert | undefined): st
21
22
  return alert === undefined || (!AWAIT_LINE.test(source) && !KAY_IMPORT.test(source)) ? source : `${source}\n${alert.keys.map(key => `t('${key}')`).join(' ')}`
22
23
  }
23
24
 
24
- // The `island` the `--- module` fence exports: `const` for `export const island = { hydrate, persist }`, the one form the compiler reads, `listed` for any other, `export { island }` included.
25
- export function islandExport(script: ScriptAnalysis): { form: 'const' | 'listed', span: Span } | undefined {
26
- const fence = script.moduleFence
27
-
28
- for (const statement of fence?.ast.body ?? []) {
29
- if (statement.type !== 'ExportNamedDeclaration')
30
- continue
31
-
32
- if (statement.declaration?.type === 'VariableDeclaration' && statement.declaration.declarations.some(declarator => declarator.id.type === 'Identifier' && declarator.id.name === 'island'))
33
- return { form: 'const', span: fence!.shift(statement) }
34
-
35
- if (statement.specifiers.some(specifier => specifier.exported.type === 'Identifier' ? specifier.exported.name === 'island' : specifier.exported.value === 'island'))
36
- return { form: 'listed', span: fence!.shift(statement) }
37
- }
38
-
39
- return undefined
40
- }
41
-
42
- // The problem with an `island` export nothing reads: one written any other way than `export const island`, or on a component that is no island.
43
- export function ignoredIslandExport(script: ScriptAnalysis, isIsland: boolean): Diagnostic[] {
44
- const asked = islandExport(script)
45
-
46
- if (asked !== undefined && script.island !== undefined)
47
- return [{ ...asked.span, code: 'fence-invalid', message: 'The component declares `island()` already, so its `island` export is not read', help: 'move what it says into the `island()` call and drop the export' }]
48
-
49
- if (asked?.form === 'listed')
50
- return [{ ...asked.span, code: 'fence-invalid', message: 'Only `export const island = { hydrate, persist, interactive }` is read as what the component asks of its parents', help: 'write it as that declaration' }]
51
-
52
- return asked && !isIsland ? [{ ...asked.span, code: 'fence-invalid', message: 'This component is no island, so nothing reads its `island` export', help: 'write `island()`, or drop the export' }] : []
53
- }
54
-
55
- // The `hydrate` the exported `island` asks for, when it is written as a string.
56
- export function exportedHydrate(script: ScriptAnalysis): string | undefined {
57
- if (script.island !== undefined)
58
- return script.island.hydrate
59
-
25
+ // An `island` exported by the `--- module` fence, which nothing reads: a component says what it asks of its parents with `island({ hydrate, persist, interactive })` in its script.
26
+ export function ignoredIslandExport(script: ScriptAnalysis): Diagnostic[] {
60
27
  for (const statement of script.moduleFence?.ast.body ?? []) {
61
- const declaration = statement.type === 'ExportNamedDeclaration' && statement.declaration?.type === 'VariableDeclaration' ? statement.declaration.declarations.find(each => each.id.type === 'Identifier' && each.id.name === 'island') : undefined
62
- const init = declaration?.init?.type === 'TSAsExpression' ? declaration.init.expression : declaration?.init
63
- const property = init?.type === 'ObjectExpression' ? init.properties.find(each => each.type === 'Property' && each.key.type === 'Identifier' && each.key.name === 'hydrate') : undefined
64
-
65
- if (property?.type === 'Property' && property.value.type === 'Literal' && typeof property.value.value === 'string')
66
- return property.value.value
67
- }
68
-
69
- return undefined
70
- }
71
-
72
- // The `interactive` of the exported `island`, `{ prop: whether it is on when a use leaves it out }`, read where it is written as an object of booleans.
73
- export function interactiveProps(script: ScriptAnalysis): Record<string, boolean> | undefined {
74
- if (script.island !== undefined)
75
- return script.island.interactive
76
-
77
- for (const statement of script.moduleFence?.ast.body ?? []) {
78
- const declaration = statement.type === 'ExportNamedDeclaration' && statement.declaration?.type === 'VariableDeclaration' ? statement.declaration.declarations.find(each => each.id.type === 'Identifier' && each.id.name === 'island') : undefined
79
- const init = declaration?.init?.type === 'TSAsExpression' ? declaration.init.expression : declaration?.init
80
- const property = init?.type === 'ObjectExpression' ? init.properties.find(each => each.type === 'Property' && each.key.type === 'Identifier' && each.key.name === 'interactive') : undefined
81
- const given = property?.type === 'Property' ? property.value : undefined
82
- const value = given?.type === 'TSAsExpression' ? given.expression : given
83
-
84
- if (value?.type !== 'ObjectExpression')
28
+ if (statement.type !== 'ExportNamedDeclaration')
85
29
  continue
86
30
 
87
- const props: Record<string, boolean> = {}
88
-
89
- for (const each of value.properties) {
90
- if (each.type === 'Property' && each.key.type === 'Identifier' && each.value.type === 'Literal' && typeof each.value.value === 'boolean')
91
- props[each.key.name] = each.value.value
92
- }
31
+ const named = statement.declaration?.type === 'VariableDeclaration' && statement.declaration.declarations.some(declarator => declarator.id.type === 'Identifier' && declarator.id.name === 'island')
32
+ const listed = statement.specifiers.some(specifier => specifier.exported.type === 'Identifier' ? specifier.exported.name === 'island' : specifier.exported.value === 'island')
93
33
 
94
- return props
95
- }
96
-
97
- return undefined
98
- }
99
-
100
- // The problem with an `interactive` that is no object of booleans written in place, which the compiler could not read and the runtime would take as it is.
101
- export function malformedInteractive(script: ScriptAnalysis): Diagnostic[] {
102
- for (const statement of script.moduleFence?.ast.body ?? []) {
103
- const declaration = statement.type === 'ExportNamedDeclaration' && statement.declaration?.type === 'VariableDeclaration' ? statement.declaration.declarations.find(each => each.id.type === 'Identifier' && each.id.name === 'island') : undefined
104
- const init = declaration?.init?.type === 'TSAsExpression' ? declaration.init.expression : declaration?.init
105
- const property = init?.type === 'ObjectExpression' ? init.properties.find(each => each.type === 'Property' && each.key.type === 'Identifier' && each.key.name === 'interactive') : undefined
106
-
107
- if (property?.type === 'Property' && interactiveProps(script) === undefined)
108
- return [{ ...script.moduleFence!.shift(property), code: 'fence-invalid', message: '`interactive` is read only as an object of booleans written in place, each prop with whether it is on when a use leaves it out', help: 'write `interactive: { sortable: true, selectable: false }`' }]
109
-
110
- if (property?.type === 'Property' && property.value.type === 'ObjectExpression' && property.value.properties.some(each => each.type !== 'Property' || each.key.type !== 'Identifier' || each.value.type !== 'Literal' || typeof each.value.value !== 'boolean'))
111
- return [{ ...script.moduleFence!.shift(property), code: 'fence-invalid', message: 'Every prop of `interactive` must be a name given `true` or `false`', help: 'write `interactive: { sortable: true, selectable: false }`' }]
34
+ if (named || listed)
35
+ return [{ ...script.moduleFence!.shift(statement), code: 'fence-invalid', message: 'A component declares `island({ hydrate, persist, interactive })` first in its script, and its `--- module` fence exports no `island`', help: 'write the call at the top of the script and drop the export' }]
112
36
  }
113
37
 
114
38
  return []
115
39
  }
116
40
 
117
- // Whether the `--- module` fence has `export const island = { hydrate, persist }`: what the component asks of every parent that uses it.
118
- export function exportsIslandOptions(script: ScriptAnalysis): boolean {
119
- return script.island === undefined ? islandExport(script)?.form === 'const' : script.island.asks !== undefined
120
- }
121
-
122
- // What the generated module hands `island()` of what the component asks of its parents: the `island` its `--- module` fence exports, or the object its `island()` call says.
123
- export function asksOf(script: ScriptAnalysis): string {
124
- return script.island?.asks ?? 'island'
125
- }
126
-
127
41
  // The message keys an island's source names, as the third argument to `island()`, with the flag of a lone button's form when it writes one, or nothing for an island naming none; the live values it imports go last.
128
42
  // Under `kay dev` the cause goes last, as the `data-why` the dev tool shows. A component exporting `island` passes it last of all.
129
43
  export function islandMessages(source: string, client = false, lives: string[] = [], cause?: string, fallback = false, options: string | false = false, wrapsButtons = false): string {
@@ -143,3 +57,11 @@ export function islandMessages(source: string, client = false, lives: string[] =
143
57
 
144
58
  return keys.length > 0 ? `, ${JSON.stringify(keys)}` : ''
145
59
  }
60
+
61
+ // The export of an island that lists `interactive` props, its type keeping the list, so a use turning none of them on, which renders as markup, can be handed a function; unchanged for a component that is an island in every use.
62
+ export function islandExport(expression: string, island: IslandDeclaration | undefined, options: { client?: boolean | undefined, lives?: string[] | undefined }): string {
63
+ if (island?.interactive === undefined || options.client || (options.lives?.length ?? 0) > 0 || island.hydrate !== undefined || island.persist !== undefined)
64
+ return `\nexport default ${expression}\n`
65
+
66
+ return `\nimport type { IslandAsked as KayIslandAsked } from 'kay'\nconst KayIslandExport = ${expression}\nexport default KayIslandExport as typeof KayIslandExport & KayIslandAsked<${JSON.stringify(island.interactive)}>\n`
67
+ }
@@ -5,7 +5,7 @@ export type IslandCauseKind = 'client' | 'island' | 'attribute' | 'value' | 'liv
5
5
 
6
6
  export interface IslandCause {
7
7
  kind: IslandCauseKind
8
- // The attribute (`onClick`, `bind:value`, `ref`), the `kay` value (`signal`) or the live value; `--- client` or `--- island` for the fence.
8
+ // The attribute (`onClick`, `bind:value`, `ref`), the `kay` value (`signal`) or the live value; `island()` for the declaration.
9
9
  name: string
10
10
  // Where it is in the file, which the editor reveals.
11
11
  span: Span
@@ -13,7 +13,7 @@ export interface IslandCause {
13
13
  line: number
14
14
  // The `kay` value's module, as `kay`.
15
15
  source?: string | undefined
16
- // The props the component's `island` export says make a use interactive, each with whether it is on when left out: a use turning none on renders no island.
16
+ // The props the component's `island()` call says make a use interactive, each with whether it is on when left out: a use turning none on renders no island.
17
17
  interactive?: Readonly<Record<string, boolean>> | undefined
18
18
  }
19
19
 
@@ -32,9 +32,9 @@ function staticUse(interactive: Readonly<Record<string, boolean>>): string {
32
32
  function causeText(cause: IslandCause): string {
33
33
  switch (cause.kind) {
34
34
  case 'client':
35
- return cause.name === 'island()' ? 'an `island({ render: \'client\' })` declaration' : 'a `--- client` fence'
35
+ return 'an `island({ render: \'client\' })` declaration'
36
36
  case 'island':
37
- return cause.name === 'island()' ? 'an `island()` declaration' : 'a `--- island` fence'
37
+ return 'an `island()` declaration'
38
38
  case 'attribute':
39
39
  return `\`${cause.name}\`, line ${cause.line}`
40
40
  case 'value':
@@ -48,8 +48,8 @@ function causeText(cause: IslandCause): string {
48
48
 
49
49
  // What the cause is, in a few words.
50
50
  export const CAUSE_KINDS: Record<IslandCauseKind, string> = {
51
- client: 'an `island({ render: \'client\' })` declaration (or a `--- client` fence): the component renders in the browser only',
52
- island: 'an `island()` declaration (or a `--- island` fence): the author declared the component an island',
51
+ client: 'an `island({ render: \'client\' })` declaration: the component renders in the browser only',
52
+ island: 'an `island()` declaration: the author declared the component an island',
53
53
  attribute: 'an `on*`, `bind:` or `ref` attribute: the browser handles it',
54
54
  value: 'a `kay` value of the browser, such as `signal` or `effect`, that its script uses',
55
55
  live: 'a live value its script imports: the browser follows it',
@@ -57,4 +57,4 @@ export const CAUSE_KINDS: Record<IslandCauseKind, string> = {
57
57
  }
58
58
 
59
59
  // The rule, as `kay explain island` says it.
60
- export const ISLAND_RULE = 'A component is an island when it needs the browser: an `on*`, `bind:` or `ref` in its template, a browser value of `kay` in its script, a live or persisted value it imports, or an `island()` declaration (the `--- client` and `--- island` fences before it); what an island renders is part of it. A static component that passes an island a function or a block taking parameters is an `island-prop` error, and is made an island by `island()`. A component whose `island({ interactive })` lists `interactive` props is an island only in a use that turns one on: any other use renders as markup with no script.'
60
+ export const ISLAND_RULE = 'A component is an island when it needs the browser: an `on*`, `bind:` or `ref` in its template, a browser value of `kay` in its script, a live or persisted value it imports, or an `island()` declaration; what an island renders is part of it. A static component that passes an island a function or a block taking parameters is an `island-prop` error, and is made an island by `island()`. A component whose `island({ interactive })` lists `interactive` props is an island only in a use that turns one on: any other use renders as markup with no script.'