@kayjs/kay 1.108.0 → 1.109.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 (543) hide show
  1. package/dist/eslint.js +1790 -3751
  2. package/editors/zed/extension.toml +2 -2
  3. package/llms/action-protection.md +1 -1
  4. package/llms/actions-from-islands.md +4 -4
  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 +4 -4
  13. package/llms/deprecated-lints.md +1 -6
  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 +2 -1
  22. package/llms/island-sources.md +1 -1
  23. package/llms/islands-state-to-ids.md +2 -2
  24. package/llms/islands.md +4 -2
  25. package/llms/lints.md +1 -1
  26. package/llms/live-values.md +3 -3
  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 +6 -6
  32. package/llms/prerendering.md +1 -0
  33. package/llms/production.md +2 -2
  34. package/llms/project-new-and-add.md +1 -1
  35. package/llms/project.md +4 -4
  36. package/llms/proxy-and-security.md +1 -1
  37. package/llms/queues.md +1 -1
  38. package/llms/rate-limits.md +4 -4
  39. package/llms/rendering.md +1 -1
  40. package/llms/server-islands.md +2 -2
  41. package/llms/server.md +1 -1
  42. package/llms/stores.md +1 -1
  43. package/llms/styles-and-assets.md +1 -1
  44. package/llms/testing-mount.md +49 -0
  45. package/llms/testing.md +4 -45
  46. package/llms/upgrading-1-105-config.md +13 -13
  47. package/llms/upgrading-archive.md +42 -82
  48. package/llms/upgrading.md +91 -63
  49. package/llms/whats-new.md +9 -0
  50. package/llms.txt +5 -6
  51. package/package.json +6 -10
  52. package/src/build/route-sizes.ts +2 -3
  53. package/src/check/browser-global-reads.ts +2 -2
  54. package/src/check/config-objects.ts +1 -1
  55. package/src/check/diagnose.ts +0 -22
  56. package/src/check/export-homes.ts +1 -1
  57. package/src/check/guards.ts +3 -3
  58. package/src/check/index.ts +2 -7
  59. package/src/check/moved-keys.ts +1 -1
  60. package/src/check/project.ts +3 -8
  61. package/src/check/shadow-types.ts +0 -86
  62. package/src/commands/check.ts +2 -2
  63. package/src/commands/env.ts +25 -3
  64. package/src/compiler/ast.ts +18 -16
  65. package/src/compiler/browser.ts +2 -14
  66. package/src/compiler/class-items.ts +16 -0
  67. package/src/compiler/codegen.ts +8 -8
  68. package/src/compiler/deprecated-library.ts +0 -12
  69. package/src/compiler/deprecated-lints.ts +3 -495
  70. package/src/compiler/deprecated-ui-props.ts +5 -5
  71. package/src/compiler/errors.ts +2 -2
  72. package/src/compiler/fence-checks.ts +2 -121
  73. package/src/compiler/hand-parts.ts +55 -0
  74. package/src/compiler/helper-imports.ts +2 -2
  75. package/src/compiler/image-attributes.ts +1 -3
  76. package/src/compiler/index.ts +20 -21
  77. package/src/compiler/island-arguments.ts +8 -95
  78. package/src/compiler/island-cause.ts +7 -7
  79. package/src/compiler/island-declaration.ts +2 -8
  80. package/src/compiler/island-lints.ts +12 -0
  81. package/src/compiler/island-marker.ts +3 -3
  82. package/src/compiler/island-problems.ts +25 -0
  83. package/src/compiler/jsx-class.ts +1 -25
  84. package/src/compiler/jsx.ts +2 -2
  85. package/src/compiler/kay-exports.ts +0 -2
  86. package/src/compiler/link-flags.ts +9 -38
  87. package/src/compiler/lints.ts +7 -14
  88. package/src/compiler/markup.ts +23 -26
  89. package/src/compiler/module-signals.ts +2 -2
  90. package/src/compiler/names.ts +1 -1
  91. package/src/compiler/page-settings.ts +11 -0
  92. package/src/compiler/parser.ts +6 -8
  93. package/src/compiler/plan.ts +1 -3
  94. package/src/compiler/rewrite.ts +3 -18
  95. package/src/compiler/script-server.ts +8 -3
  96. package/src/compiler/validate.ts +3 -8
  97. package/src/config-loader.ts +14 -4
  98. package/src/config-resolve.ts +18 -142
  99. package/src/config-shape.ts +44 -34
  100. package/src/config.ts +10 -114
  101. package/src/dev/preload.ts +4 -1
  102. package/src/lsp/server.ts +4 -0
  103. package/src/migrate/markup.ts +4 -1
  104. package/src/runtime/action-call.ts +0 -8
  105. package/src/runtime/action-encode.ts +26 -0
  106. package/src/runtime/action-error.ts +3 -11
  107. package/src/runtime/action-protection.ts +2 -2
  108. package/src/runtime/action-run.ts +2 -27
  109. package/src/runtime/action-shared.ts +14 -37
  110. package/src/runtime/action-stream.ts +0 -1
  111. package/src/runtime/action.ts +1 -1
  112. package/src/runtime/call-result.ts +2 -10
  113. package/src/runtime/checks.ts +11 -11
  114. package/src/runtime/client.ts +2 -2
  115. package/src/runtime/core.ts +5 -23
  116. package/src/runtime/dom.ts +1 -1
  117. package/src/runtime/html.ts +1 -1
  118. package/src/runtime/i18n.client.ts +1 -4
  119. package/src/runtime/i18n.server.ts +1 -4
  120. package/src/runtime/i18n.ts +3 -3
  121. package/src/runtime/index.ts +2 -2
  122. package/src/runtime/island.server.ts +18 -5
  123. package/src/runtime/live-resource.server.ts +0 -1
  124. package/src/runtime/live-value.server.ts +2 -2
  125. package/src/runtime/live-value.shared.ts +7 -20
  126. package/src/runtime/live.ts +1 -12
  127. package/src/runtime/local-types.ts +1 -11
  128. package/src/runtime/local.ts +4 -14
  129. package/src/runtime/navigate-api.ts +2 -5
  130. package/src/runtime/navigation-state.ts +0 -12
  131. package/src/runtime/page-swap.ts +6 -6
  132. package/src/runtime/persist.ts +11 -3
  133. package/src/runtime/persisted.ts +4 -30
  134. package/src/runtime/presence.ts +6 -7
  135. package/src/runtime/query-param.ts +20 -12
  136. package/src/runtime/reactive.ts +3 -1
  137. package/src/runtime/refuse.ts +3 -17
  138. package/src/runtime/store-base.ts +4 -6
  139. package/src/runtime/swap-fetch.ts +1 -1
  140. package/src/runtime/values.ts +40 -23
  141. package/src/runtime/with-query.ts +9 -0
  142. package/src/server/action-hooks.ts +8 -8
  143. package/src/server/actions.ts +13 -14
  144. package/src/server/api-modules.ts +2 -3
  145. package/src/server/app-stages.ts +15 -33
  146. package/src/server/app.ts +10 -5
  147. package/src/server/auth-mails.ts +0 -2
  148. package/src/server/env-state.ts +40 -10
  149. package/src/server/flash.ts +1 -1
  150. package/src/server/guard-requirement.ts +4 -4
  151. package/src/server/image.ts +2 -2
  152. package/src/server/index.ts +0 -2
  153. package/src/server/job-context.ts +3 -3
  154. package/src/server/jobs-page.ts +1 -1
  155. package/src/server/jobs.ts +5 -9
  156. package/src/server/kept-exports.ts +0 -2
  157. package/src/server/kv.ts +11 -14
  158. package/src/server/library.ts +1 -3
  159. package/src/server/live.ts +2 -2
  160. package/src/server/mcp.ts +3 -9
  161. package/src/server/metrics.ts +2 -4
  162. package/src/server/page-settings.ts +10 -19
  163. package/src/server/prerender.ts +19 -2
  164. package/src/server/protection.ts +15 -18
  165. package/src/server/queue.ts +3 -6
  166. package/src/server/rate-limit.ts +0 -3
  167. package/src/server/render-document.ts +1 -1
  168. package/src/server/routes.ts +7 -3
  169. package/src/server/scope.ts +3 -2
  170. package/src/server/session.ts +5 -6
  171. package/src/server/setup.ts +1 -1
  172. package/src/server/signals.ts +17 -7
  173. package/src/server/signed.ts +1 -3
  174. package/src/server/source.ts +20 -4
  175. package/src/server/speculation.ts +1 -1
  176. package/src/server/storage.ts +3 -8
  177. package/src/server/validate.ts +1 -1
  178. package/src/server/vitals.ts +1 -3
  179. package/src/server/work-scope.ts +2 -4
  180. package/src/server/work.ts +1 -1
  181. package/src/server/workflow.ts +1 -1
  182. package/src/test/index.ts +2 -1
  183. package/src/test/site-actions.ts +16 -6
  184. package/src/test/site-keys.ts +10 -15
  185. package/src/test/site-socket.ts +1 -2
  186. package/src/test/site-types.ts +0 -8
  187. package/types/build/route-sizes.d.ts.map +1 -1
  188. package/types/check/diagnose.d.ts.map +1 -1
  189. package/types/check/index.d.ts +1 -2
  190. package/types/check/index.d.ts.map +1 -1
  191. package/types/check/project.d.ts.map +1 -1
  192. package/types/check/shadow-types.d.ts.map +1 -1
  193. package/types/commands/env.d.ts.map +1 -1
  194. package/types/compiler/ast.d.ts +1 -2
  195. package/types/compiler/ast.d.ts.map +1 -1
  196. package/types/compiler/browser.d.ts.map +1 -1
  197. package/types/compiler/class-items.d.ts +7 -0
  198. package/types/compiler/class-items.d.ts.map +1 -0
  199. package/types/compiler/deprecated-library.d.ts.map +1 -1
  200. package/types/compiler/deprecated-lints.d.ts +0 -551
  201. package/types/compiler/deprecated-lints.d.ts.map +1 -1
  202. package/types/compiler/deprecated-ui-props.d.ts +1 -8
  203. package/types/compiler/deprecated-ui-props.d.ts.map +1 -1
  204. package/types/compiler/errors.d.ts +2 -2
  205. package/types/compiler/errors.d.ts.map +1 -1
  206. package/types/compiler/fence-checks.d.ts +0 -1
  207. package/types/compiler/fence-checks.d.ts.map +1 -1
  208. package/types/compiler/hand-parts.d.ts +7 -0
  209. package/types/compiler/hand-parts.d.ts.map +1 -0
  210. package/types/compiler/image-attributes.d.ts +0 -1
  211. package/types/compiler/image-attributes.d.ts.map +1 -1
  212. package/types/compiler/index.d.ts.map +1 -1
  213. package/types/compiler/island-arguments.d.ts +2 -11
  214. package/types/compiler/island-arguments.d.ts.map +1 -1
  215. package/types/compiler/island-cause.d.ts +1 -1
  216. package/types/compiler/island-cause.d.ts.map +1 -1
  217. package/types/compiler/island-declaration.d.ts +1 -3
  218. package/types/compiler/island-declaration.d.ts.map +1 -1
  219. package/types/compiler/island-lints.d.ts +10 -0
  220. package/types/compiler/island-lints.d.ts.map +1 -0
  221. package/types/compiler/island-problems.d.ts +7 -0
  222. package/types/compiler/island-problems.d.ts.map +1 -0
  223. package/types/compiler/jsx-class.d.ts +1 -2
  224. package/types/compiler/jsx-class.d.ts.map +1 -1
  225. package/types/compiler/kay-exports.d.ts.map +1 -1
  226. package/types/compiler/link-flags.d.ts +0 -6
  227. package/types/compiler/link-flags.d.ts.map +1 -1
  228. package/types/compiler/lints.d.ts +11 -563
  229. package/types/compiler/lints.d.ts.map +1 -1
  230. package/types/compiler/markup.d.ts +1 -1
  231. package/types/compiler/markup.d.ts.map +1 -1
  232. package/types/compiler/module-signals.d.ts.map +1 -1
  233. package/types/compiler/names.d.ts.map +1 -1
  234. package/types/compiler/page-settings.d.ts +4 -0
  235. package/types/compiler/page-settings.d.ts.map +1 -1
  236. package/types/compiler/parser.d.ts.map +1 -1
  237. package/types/compiler/plan.d.ts.map +1 -1
  238. package/types/compiler/script-server.d.ts.map +1 -1
  239. package/types/compiler/validate.d.ts.map +1 -1
  240. package/types/config-loader.d.ts.map +1 -1
  241. package/types/config-resolve.d.ts.map +1 -1
  242. package/types/config-shape.d.ts +1 -1
  243. package/types/config-shape.d.ts.map +1 -1
  244. package/types/config.d.ts +5 -105
  245. package/types/config.d.ts.map +1 -1
  246. package/types/dev/preload.d.ts.map +1 -1
  247. package/types/lsp/server.d.ts.map +1 -1
  248. package/types/migrate/markup.d.ts.map +1 -1
  249. package/types/runtime/action-call.d.ts.map +1 -1
  250. package/types/runtime/action-encode.d.ts +1 -0
  251. package/types/runtime/action-encode.d.ts.map +1 -1
  252. package/types/runtime/action-error.d.ts +1 -2
  253. package/types/runtime/action-error.d.ts.map +1 -1
  254. package/types/runtime/action-run.d.ts.map +1 -1
  255. package/types/runtime/action-shared.d.ts +1 -27
  256. package/types/runtime/action-shared.d.ts.map +1 -1
  257. package/types/runtime/action-stream.d.ts.map +1 -1
  258. package/types/runtime/action.d.ts +1 -1
  259. package/types/runtime/action.d.ts.map +1 -1
  260. package/types/runtime/call-result.d.ts +0 -10
  261. package/types/runtime/call-result.d.ts.map +1 -1
  262. package/types/runtime/checks.d.ts +6 -9
  263. package/types/runtime/checks.d.ts.map +1 -1
  264. package/types/runtime/core.d.ts +2 -20
  265. package/types/runtime/core.d.ts.map +1 -1
  266. package/types/runtime/dom.d.ts +1 -1
  267. package/types/runtime/dom.d.ts.map +1 -1
  268. package/types/runtime/html.d.ts +1 -1
  269. package/types/runtime/html.d.ts.map +1 -1
  270. package/types/runtime/i18n.client.d.ts +0 -1
  271. package/types/runtime/i18n.client.d.ts.map +1 -1
  272. package/types/runtime/i18n.d.ts +1 -1
  273. package/types/runtime/i18n.d.ts.map +1 -1
  274. package/types/runtime/i18n.server.d.ts +0 -1
  275. package/types/runtime/i18n.server.d.ts.map +1 -1
  276. package/types/runtime/index.d.ts +2 -2
  277. package/types/runtime/index.d.ts.map +1 -1
  278. package/types/runtime/island.server.d.ts +1 -0
  279. package/types/runtime/island.server.d.ts.map +1 -1
  280. package/types/runtime/live-resource.server.d.ts.map +1 -1
  281. package/types/runtime/live-value.shared.d.ts +7 -15
  282. package/types/runtime/live-value.shared.d.ts.map +1 -1
  283. package/types/runtime/live.d.ts +0 -11
  284. package/types/runtime/live.d.ts.map +1 -1
  285. package/types/runtime/local-types.d.ts +0 -14
  286. package/types/runtime/local-types.d.ts.map +1 -1
  287. package/types/runtime/navigate-api.d.ts +0 -4
  288. package/types/runtime/navigate-api.d.ts.map +1 -1
  289. package/types/runtime/navigation-state.d.ts +0 -4
  290. package/types/runtime/navigation-state.d.ts.map +1 -1
  291. package/types/runtime/page-swap.d.ts.map +1 -1
  292. package/types/runtime/persist.d.ts +1 -0
  293. package/types/runtime/persist.d.ts.map +1 -1
  294. package/types/runtime/persisted.d.ts +0 -15
  295. package/types/runtime/persisted.d.ts.map +1 -1
  296. package/types/runtime/presence.d.ts +0 -2
  297. package/types/runtime/presence.d.ts.map +1 -1
  298. package/types/runtime/query-param.d.ts.map +1 -1
  299. package/types/runtime/reactive.d.ts +2 -1
  300. package/types/runtime/reactive.d.ts.map +1 -1
  301. package/types/runtime/refuse.d.ts +0 -7
  302. package/types/runtime/refuse.d.ts.map +1 -1
  303. package/types/runtime/store-base.d.ts +1 -2
  304. package/types/runtime/store-base.d.ts.map +1 -1
  305. package/types/runtime/values.d.ts +2 -1
  306. package/types/runtime/values.d.ts.map +1 -1
  307. package/types/runtime/with-query.d.ts +2 -0
  308. package/types/runtime/with-query.d.ts.map +1 -1
  309. package/types/server/action-hooks.d.ts +4 -4
  310. package/types/server/action-hooks.d.ts.map +1 -1
  311. package/types/server/actions.d.ts.map +1 -1
  312. package/types/server/api-modules.d.ts +0 -1
  313. package/types/server/api-modules.d.ts.map +1 -1
  314. package/types/server/app-stages.d.ts +5 -13
  315. package/types/server/app-stages.d.ts.map +1 -1
  316. package/types/server/app.d.ts +3 -8
  317. package/types/server/app.d.ts.map +1 -1
  318. package/types/server/auth-mails.d.ts +0 -5
  319. package/types/server/auth-mails.d.ts.map +1 -1
  320. package/types/server/env-state.d.ts +1 -0
  321. package/types/server/env-state.d.ts.map +1 -1
  322. package/types/server/guard-requirement.d.ts +0 -1
  323. package/types/server/guard-requirement.d.ts.map +1 -1
  324. package/types/server/image.d.ts +0 -1
  325. package/types/server/image.d.ts.map +1 -1
  326. package/types/server/index.d.ts +0 -2
  327. package/types/server/index.d.ts.map +1 -1
  328. package/types/server/job-context.d.ts +1 -1
  329. package/types/server/job-context.d.ts.map +1 -1
  330. package/types/server/jobs.d.ts +0 -4
  331. package/types/server/jobs.d.ts.map +1 -1
  332. package/types/server/kept-exports.d.ts.map +1 -1
  333. package/types/server/kv.d.ts +4 -4
  334. package/types/server/kv.d.ts.map +1 -1
  335. package/types/server/library.d.ts +1 -3
  336. package/types/server/library.d.ts.map +1 -1
  337. package/types/server/mcp.d.ts +0 -1
  338. package/types/server/mcp.d.ts.map +1 -1
  339. package/types/server/metrics.d.ts +0 -5
  340. package/types/server/metrics.d.ts.map +1 -1
  341. package/types/server/page-settings.d.ts +3 -3
  342. package/types/server/page-settings.d.ts.map +1 -1
  343. package/types/server/prerender.d.ts.map +1 -1
  344. package/types/server/protection.d.ts +6 -6
  345. package/types/server/protection.d.ts.map +1 -1
  346. package/types/server/queue.d.ts +1 -3
  347. package/types/server/queue.d.ts.map +1 -1
  348. package/types/server/rate-limit.d.ts +0 -2
  349. package/types/server/rate-limit.d.ts.map +1 -1
  350. package/types/server/routes.d.ts +1 -1
  351. package/types/server/routes.d.ts.map +1 -1
  352. package/types/server/scope.d.ts.map +1 -1
  353. package/types/server/session.d.ts +1 -1
  354. package/types/server/session.d.ts.map +1 -1
  355. package/types/server/signals.d.ts.map +1 -1
  356. package/types/server/signed.d.ts +0 -2
  357. package/types/server/signed.d.ts.map +1 -1
  358. package/types/server/source.d.ts +1 -1
  359. package/types/server/source.d.ts.map +1 -1
  360. package/types/server/storage.d.ts +0 -4
  361. package/types/server/storage.d.ts.map +1 -1
  362. package/types/server/vitals.d.ts +0 -1
  363. package/types/server/vitals.d.ts.map +1 -1
  364. package/types/server/work-scope.d.ts +0 -2
  365. package/types/server/work-scope.d.ts.map +1 -1
  366. package/types/server/workflow.d.ts +1 -1
  367. package/types/server/workflow.d.ts.map +1 -1
  368. package/types/test/index.d.ts.map +1 -1
  369. package/types/test/site-actions.d.ts +1 -1
  370. package/types/test/site-actions.d.ts.map +1 -1
  371. package/types/test/site-keys.d.ts +1 -1
  372. package/types/test/site-keys.d.ts.map +1 -1
  373. package/types/test/site-socket.d.ts +1 -1
  374. package/types/test/site-socket.d.ts.map +1 -1
  375. package/types/test/site-types.d.ts +0 -8
  376. package/types/test/site-types.d.ts.map +1 -1
  377. package/llms/deprecated-lints-1-105-libraries.md +0 -32
  378. package/llms/deprecated-lints-1-105.md +0 -58
  379. package/src/check/action-readers.ts +0 -115
  380. package/src/check/action-type.ts +0 -44
  381. package/src/check/ai-language.ts +0 -56
  382. package/src/check/app-hooks.ts +0 -90
  383. package/src/check/auth-methods.ts +0 -85
  384. package/src/check/auth-rate-limits.ts +0 -99
  385. package/src/check/call-result.ts +0 -242
  386. package/src/check/client-keys.ts +0 -10
  387. package/src/check/cms-options.ts +0 -81
  388. package/src/check/config-groups.ts +0 -22
  389. package/src/check/config-switches.ts +0 -38
  390. package/src/check/context-import.ts +0 -51
  391. package/src/check/env-files.ts +0 -31
  392. package/src/check/format-duration.ts +0 -75
  393. package/src/check/guard-options.ts +0 -58
  394. package/src/check/handler-events.ts +0 -149
  395. package/src/check/hook-context.ts +0 -94
  396. package/src/check/hook-names.ts +0 -104
  397. package/src/check/i18n-keys.ts +0 -50
  398. package/src/check/images-keys.ts +0 -54
  399. package/src/check/job-shapes.ts +0 -273
  400. package/src/check/link-flag-tests.ts +0 -130
  401. package/src/check/live-api.ts +0 -137
  402. package/src/check/mail-api.ts +0 -67
  403. package/src/check/one-state-api.ts +0 -357
  404. package/src/check/pages-options.ts +0 -35
  405. package/src/check/rate-enforce.ts +0 -53
  406. package/src/check/refusal-calls.ts +0 -185
  407. package/src/check/retired-lints.ts +0 -49
  408. package/src/check/route-keys.ts +0 -166
  409. package/src/check/secret-keys.ts +0 -83
  410. package/src/check/socket-frames.ts +0 -102
  411. package/src/check/source-readers.ts +0 -257
  412. package/src/check/store-ms.ts +0 -72
  413. package/src/check/store-names.ts +0 -88
  414. package/src/check/test-helpers.ts +0 -98
  415. package/src/check/ttl-names.ts +0 -142
  416. package/src/compiler/deprecated-ai-labels.ts +0 -97
  417. package/src/compiler/deprecated-ai-links.ts +0 -63
  418. package/src/compiler/deprecated-allow.ts +0 -50
  419. package/src/compiler/deprecated-auth-lints.ts +0 -14
  420. package/src/compiler/deprecated-auth-signed.ts +0 -29
  421. package/src/compiler/deprecated-children.ts +0 -66
  422. package/src/compiler/deprecated-image.ts +0 -116
  423. package/src/compiler/deprecated-island.ts +0 -155
  424. package/src/compiler/deprecated-lints-1-105.ts +0 -41
  425. package/src/compiler/deprecated-page.ts +0 -125
  426. package/src/compiler/deprecated-parts.ts +0 -22
  427. package/src/compiler/deprecated-typed-lints.ts +0 -23
  428. package/src/compiler/deprecated-ui-callbacks.ts +0 -66
  429. package/src/compiler/deprecated-ui-input.ts +0 -97
  430. package/src/compiler/deprecated-ui-items.ts +0 -47
  431. package/src/compiler/old-parts.ts +0 -84
  432. package/src/runtime/mount.compat.ts +0 -8
  433. package/src/server/moved-exports.ts +0 -17
  434. package/types/check/action-readers.d.ts +0 -3
  435. package/types/check/action-readers.d.ts.map +0 -1
  436. package/types/check/action-type.d.ts +0 -3
  437. package/types/check/action-type.d.ts.map +0 -1
  438. package/types/check/ai-language.d.ts +0 -3
  439. package/types/check/ai-language.d.ts.map +0 -1
  440. package/types/check/app-hooks.d.ts +0 -3
  441. package/types/check/app-hooks.d.ts.map +0 -1
  442. package/types/check/auth-methods.d.ts +0 -3
  443. package/types/check/auth-methods.d.ts.map +0 -1
  444. package/types/check/auth-rate-limits.d.ts +0 -3
  445. package/types/check/auth-rate-limits.d.ts.map +0 -1
  446. package/types/check/call-result.d.ts +0 -7
  447. package/types/check/call-result.d.ts.map +0 -1
  448. package/types/check/client-keys.d.ts +0 -3
  449. package/types/check/client-keys.d.ts.map +0 -1
  450. package/types/check/cms-options.d.ts +0 -3
  451. package/types/check/cms-options.d.ts.map +0 -1
  452. package/types/check/config-groups.d.ts +0 -3
  453. package/types/check/config-groups.d.ts.map +0 -1
  454. package/types/check/config-switches.d.ts +0 -3
  455. package/types/check/config-switches.d.ts.map +0 -1
  456. package/types/check/context-import.d.ts +0 -3
  457. package/types/check/context-import.d.ts.map +0 -1
  458. package/types/check/env-files.d.ts +0 -3
  459. package/types/check/env-files.d.ts.map +0 -1
  460. package/types/check/format-duration.d.ts +0 -5
  461. package/types/check/format-duration.d.ts.map +0 -1
  462. package/types/check/guard-options.d.ts +0 -3
  463. package/types/check/guard-options.d.ts.map +0 -1
  464. package/types/check/handler-events.d.ts +0 -9
  465. package/types/check/handler-events.d.ts.map +0 -1
  466. package/types/check/hook-context.d.ts +0 -3
  467. package/types/check/hook-context.d.ts.map +0 -1
  468. package/types/check/hook-names.d.ts +0 -3
  469. package/types/check/hook-names.d.ts.map +0 -1
  470. package/types/check/i18n-keys.d.ts +0 -3
  471. package/types/check/i18n-keys.d.ts.map +0 -1
  472. package/types/check/images-keys.d.ts +0 -3
  473. package/types/check/images-keys.d.ts.map +0 -1
  474. package/types/check/job-shapes.d.ts +0 -6
  475. package/types/check/job-shapes.d.ts.map +0 -1
  476. package/types/check/link-flag-tests.d.ts +0 -4
  477. package/types/check/link-flag-tests.d.ts.map +0 -1
  478. package/types/check/live-api.d.ts +0 -3
  479. package/types/check/live-api.d.ts.map +0 -1
  480. package/types/check/mail-api.d.ts +0 -3
  481. package/types/check/mail-api.d.ts.map +0 -1
  482. package/types/check/one-state-api.d.ts +0 -9
  483. package/types/check/one-state-api.d.ts.map +0 -1
  484. package/types/check/pages-options.d.ts +0 -3
  485. package/types/check/pages-options.d.ts.map +0 -1
  486. package/types/check/rate-enforce.d.ts +0 -3
  487. package/types/check/rate-enforce.d.ts.map +0 -1
  488. package/types/check/refusal-calls.d.ts +0 -3
  489. package/types/check/refusal-calls.d.ts.map +0 -1
  490. package/types/check/retired-lints.d.ts +0 -3
  491. package/types/check/retired-lints.d.ts.map +0 -1
  492. package/types/check/route-keys.d.ts +0 -3
  493. package/types/check/route-keys.d.ts.map +0 -1
  494. package/types/check/secret-keys.d.ts +0 -3
  495. package/types/check/secret-keys.d.ts.map +0 -1
  496. package/types/check/socket-frames.d.ts +0 -3
  497. package/types/check/socket-frames.d.ts.map +0 -1
  498. package/types/check/source-readers.d.ts +0 -3
  499. package/types/check/source-readers.d.ts.map +0 -1
  500. package/types/check/store-ms.d.ts +0 -3
  501. package/types/check/store-ms.d.ts.map +0 -1
  502. package/types/check/store-names.d.ts +0 -3
  503. package/types/check/store-names.d.ts.map +0 -1
  504. package/types/check/test-helpers.d.ts +0 -3
  505. package/types/check/test-helpers.d.ts.map +0 -1
  506. package/types/check/ttl-names.d.ts +0 -3
  507. package/types/check/ttl-names.d.ts.map +0 -1
  508. package/types/compiler/deprecated-ai-labels.d.ts +0 -5
  509. package/types/compiler/deprecated-ai-labels.d.ts.map +0 -1
  510. package/types/compiler/deprecated-ai-links.d.ts +0 -5
  511. package/types/compiler/deprecated-ai-links.d.ts.map +0 -1
  512. package/types/compiler/deprecated-allow.d.ts +0 -5
  513. package/types/compiler/deprecated-allow.d.ts.map +0 -1
  514. package/types/compiler/deprecated-auth-lints.d.ts +0 -12
  515. package/types/compiler/deprecated-auth-lints.d.ts.map +0 -1
  516. package/types/compiler/deprecated-auth-signed.d.ts +0 -5
  517. package/types/compiler/deprecated-auth-signed.d.ts.map +0 -1
  518. package/types/compiler/deprecated-children.d.ts +0 -4
  519. package/types/compiler/deprecated-children.d.ts.map +0 -1
  520. package/types/compiler/deprecated-image.d.ts +0 -5
  521. package/types/compiler/deprecated-image.d.ts.map +0 -1
  522. package/types/compiler/deprecated-island.d.ts +0 -9
  523. package/types/compiler/deprecated-island.d.ts.map +0 -1
  524. package/types/compiler/deprecated-lints-1-105.d.ts +0 -39
  525. package/types/compiler/deprecated-lints-1-105.d.ts.map +0 -1
  526. package/types/compiler/deprecated-page.d.ts +0 -4
  527. package/types/compiler/deprecated-page.d.ts.map +0 -1
  528. package/types/compiler/deprecated-parts.d.ts +0 -3
  529. package/types/compiler/deprecated-parts.d.ts.map +0 -1
  530. package/types/compiler/deprecated-typed-lints.d.ts +0 -21
  531. package/types/compiler/deprecated-typed-lints.d.ts.map +0 -1
  532. package/types/compiler/deprecated-ui-callbacks.d.ts +0 -5
  533. package/types/compiler/deprecated-ui-callbacks.d.ts.map +0 -1
  534. package/types/compiler/deprecated-ui-input.d.ts +0 -5
  535. package/types/compiler/deprecated-ui-input.d.ts.map +0 -1
  536. package/types/compiler/deprecated-ui-items.d.ts +0 -5
  537. package/types/compiler/deprecated-ui-items.d.ts.map +0 -1
  538. package/types/compiler/old-parts.d.ts +0 -9
  539. package/types/compiler/old-parts.d.ts.map +0 -1
  540. package/types/runtime/mount.compat.d.ts +0 -7
  541. package/types/runtime/mount.compat.d.ts.map +0 -1
  542. package/types/server/moved-exports.d.ts +0 -12
  543. 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,55 @@
1
+ import type { Attribute, ElementNode, NamedAttribute } from './ast'
2
+ import type { CodeBuilder } from './mapping'
3
+ import { helperName } from './markup'
4
+
5
+ type ExpressionAttribute = Extract<NamedAttribute, { kind: 'expression' }>
6
+
7
+ // 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.
8
+ export function writtenParts(element: ElementNode, source: string): Attribute[] {
9
+ const hand = element.attributes.find((one): one is ExpressionAttribute => one.kind === 'expression' && source.slice(one.name.start, one.name.end) === 'parts')
10
+
11
+ return [...element.attributes.filter(one => one.kind === 'spread'), hand].filter(attribute => attribute !== undefined)
12
+ }
13
+
14
+ // 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.
15
+ export function openClassList(b: CodeBuilder, component: boolean, parts: boolean, handing: readonly Attribute[] | undefined): void {
16
+ const helper = handing ? 'handParts' : 'partsClass'
17
+
18
+ b.add(component ? `${helperName(parts ? helper : 'componentClass')}([` : '[')
19
+ }
20
+
21
+ // What closes the `handParts` of a call: the `parts` it writes, the spreads' under them.
22
+ export function closeHandParts(b: CodeBuilder, component: boolean, written: readonly Attribute[] | undefined): void {
23
+ b.add(component && !written ? '])' : ']')
24
+
25
+ const given = written?.filter(attribute => attribute.kind === 'expression' || attribute.kind === 'spread') ?? []
26
+ const emit = (attribute: (typeof given)[number]) => {
27
+ if (attribute.kind === 'spread')
28
+ b.add('((').addSource(attribute.expression).add(') as unknown as { parts?: unknown }).parts')
29
+ else if (attribute.kind === 'expression')
30
+ b.add('(').addSource(attribute.expression).add(')')
31
+ }
32
+
33
+ if (given.length === 1) {
34
+ b.add(', ')
35
+ emit(given[0]!)
36
+ }
37
+ else if (given.length > 1) {
38
+ b.add(', { ')
39
+
40
+ for (const [index, attribute] of given.entries()) {
41
+ b.add(index === 0 ? '...' : ', ...')
42
+ emit(attribute)
43
+ }
44
+
45
+ b.add(' }')
46
+ }
47
+
48
+ if (written)
49
+ b.add(')')
50
+ }
51
+
52
+ // Whether an attribute of a call handing parts on is one it writes itself, as `parts`: the `parts` and the spreads.
53
+ export function handsEntry(element: ElementNode, source: string, attribute: NamedAttribute, hands: boolean): boolean {
54
+ return hands && writtenParts(element, source).includes(attribute)
55
+ }
@@ -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', 'partsClass', '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', 'partsClass', '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'
@@ -83,7 +79,7 @@ export interface CompileOptions {
83
79
  twinBuild?: boolean | undefined
84
80
  // 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
81
  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.
82
+ // 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
83
  page?: boolean | undefined
88
84
  // 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
85
  component?: boolean | undefined
@@ -91,7 +87,7 @@ export interface CompileOptions {
91
87
  lints?: LintLevels | undefined
92
88
  // 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
89
  typesOnly?: boolean | undefined
94
- // Renders in the browser only, as `--- client` does: set when a package the component imports cannot load on the server.
90
+ // Renders in the browser only, as `island({ render: 'client' })` does: set when a package the component imports cannot load on the server.
95
91
  clientOnly?: boolean | undefined
96
92
  // Type-checking a static component only islands render: its children render inline with it, so the props it passes them are not serialized.
97
93
  insideIsland?: boolean | undefined
@@ -182,9 +178,9 @@ function browserCause(file: KayFile, script: ScriptAnalysis, value: ReturnType<t
182
178
  return value === undefined || binding === undefined ? undefined : { kind: value.kind, name: value.local, span: binding.span, line: lineOf(file.source, binding.span.start) }
183
179
  }
184
180
 
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.
181
+ // 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
182
  function withInteractive(cause: IslandCause | undefined, script: ScriptAnalysis): IslandCause | undefined {
187
- const interactive = interactiveProps(script)
183
+ const interactive = script.island?.interactive
188
184
 
189
185
  return cause !== undefined && interactive !== undefined && cause.kind !== 'client' && cause.kind !== 'live' && cause.kind !== 'persisted' ? { ...cause, interactive } : cause
190
186
  }
@@ -204,12 +200,12 @@ function staticPin(span: Span, cause: IslandCause): Diagnostic {
204
200
  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
201
  }
206
202
 
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[] {
203
+ // 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.
204
+ function pageIsland(page: boolean, route: boolean, client: boolean, check: boolean | undefined, raw: IslandCause | undefined, cause: IslandCause | undefined): Diagnostic[] {
209
205
  if (!page || route || client || check !== true || raw === undefined || cause === undefined)
210
206
  return []
211
207
 
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' }]
208
+ 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
209
  }
214
210
 
215
211
  // 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 +215,9 @@ function serverNames(server: ServerAnalysis | undefined): string[] | undefined {
219
215
 
220
216
  // What a component's script and template say of its role in the browser, from one analysis.
221
217
  interface Role {
222
- // A `--- client` component or an interactive one, an island whatever its file.
218
+ // A client-only component or an interactive one, an island whatever its file.
223
219
  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.
220
+ // 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
221
  pinned: boolean
226
222
  // 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
223
  live: boolean
@@ -263,7 +259,7 @@ function roleOf(original: string, imported: ImportedSignals | undefined, page: b
263
259
  }
264
260
 
265
261
  // 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.
262
+ // `page` says the file is a page of the routes directory (`isPageFile`), which its `island()` declaration does not make an island.
267
263
  export function rendersAsIsland(original: string, imported?: ImportedSignals, page = false): boolean {
268
264
  const { always, live, pinned, server } = roleOf(original, imported, page)
269
265
 
@@ -356,7 +352,7 @@ export function compileKay(original: string, filename: string, options: CompileO
356
352
  ...coded(server ? separatePageSettings(source, server) : [], 'page-settings-invalid'),
357
353
  ...validate(file, script, server, generateOptions),
358
354
  ...coded(unparsed ? [] : found.diagnostics, 'signal-misuse'),
359
- ...deprecatedPageIsland(pageFile, routeFile, client, options.check, rawCause, cause),
355
+ ...pageIsland(pageFile, routeFile, client, options.check, rawCause, cause),
360
356
  ...coded(pin?.kind === 'static' && cause !== undefined && rawCause !== undefined && !routeFile && island !== undefined ? [staticPin(rawCause.span, { ...cause, interactive: undefined })] : [], 'static-pin'),
361
357
  ]
362
358
 
@@ -369,6 +365,9 @@ export function compileKay(original: string, filename: string, options: CompileO
369
365
  // Type checking only, so a page still runs while it is fixed, and fails there in development naming the same fixes.
370
366
  const serverData = server?.data.map(data => data.name) ?? []
371
367
 
368
+ // The `island` export of the `--- module` fence read before 1.109 is an error in every output, as it declares nothing now.
369
+ diagnostics.push(...ignoredIslandExport(script))
370
+
372
371
  if (checked && !client)
373
372
  diagnostics.push(...coded(browserReads(file, island !== undefined, serverData, routeFile), 'browser-only-read'), ...coded(serverImportReads(file, script, server, island !== undefined), 'server-import-in-island'))
374
373
 
@@ -379,12 +378,12 @@ export function compileKay(original: string, filename: string, options: CompileO
379
378
  const broken = diagnostics.some(diagnostic => !diagnostic.checkOnly)
380
379
 
381
380
  if (checked) {
382
- const fenceLints = [script.fence, script.moduleFence, server?.fence].flatMap(fence => fence ? [...cssImportsWithoutText(fence), ...asyncReplies(fence), ...openRedirects(fence), ...missingCaptchas(fence), ...unreturnedFails(fence)] : [])
381
+ const fenceLints = [script.fence, script.moduleFence, server?.fence].flatMap(fence => fence ? [...cssImportsWithoutText(fence), ...asyncReplies(fence), ...openRedirects(fence), ...missingCaptchas(fence)] : [])
383
382
  // The script runs in the browser as an island's and in a component only islands render.
384
383
  const browserScript = (island !== undefined || options.insideIsland === true) && !routeFile ? scriptFences(script) : []
385
384
  const unusedLints = broken ? [] : [...unreadNames(source, file.template, script, server, found.findings), ...constantSignals(source, [file.script, file.module], found.findings)]
386
385
 
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))
386
+ 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), ...linkFlags(file))
388
387
  }
389
388
 
390
389
  if (checked && pin !== undefined)
@@ -537,7 +536,7 @@ function takeBlock(file: KayFile, filename: string, options: CompileOptions, scr
537
536
  const at = file.source.slice(block.start, block.end).search(new RegExp(`(?<![\\w$])${name.replaceAll('$', '\\$')}(?![\\w$])`, 'g'))
538
537
  const start = at < 0 ? block.name.start : block.start + at
539
538
 
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' })
539
+ 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
540
  }
542
541
 
543
542
  return { code: compiled.tsx.replace(FALLBACK_COMPONENT, which === 'failed' ? 'function KayFailed(' : 'function KayFallback('), classes: compiled.classes }
@@ -1,4 +1,4 @@
1
- import type { Diagnostic, Span } from './ast'
1
+ import type { Diagnostic } from './ast'
2
2
  import type { AwaitAlert } from './names'
3
3
  import type { ScriptAnalysis } from './script'
4
4
  import { AWAIT_FAILED_KEY } from '../runtime/await-failed'
@@ -21,109 +21,22 @@ export function withAlertKeys(source: string, alert: AwaitAlert | undefined): st
21
21
  return alert === undefined || (!AWAIT_LINE.test(source) && !KAY_IMPORT.test(source)) ? source : `${source}\n${alert.keys.map(key => `t('${key}')`).join(' ')}`
22
22
  }
23
23
 
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
-
60
- 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
-
24
+ // 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.
25
+ export function ignoredIslandExport(script: ScriptAnalysis): Diagnostic[] {
77
26
  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')
27
+ if (statement.type !== 'ExportNamedDeclaration')
85
28
  continue
86
29
 
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
- }
93
-
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 }`' }]
30
+ const named = statement.declaration?.type === 'VariableDeclaration' && statement.declaration.declarations.some(declarator => declarator.id.type === 'Identifier' && declarator.id.name === 'island')
31
+ const listed = statement.specifiers.some(specifier => specifier.exported.type === 'Identifier' ? specifier.exported.name === 'island' : specifier.exported.value === 'island')
109
32
 
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 }`' }]
33
+ if (named || listed)
34
+ 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
35
  }
113
36
 
114
37
  return []
115
38
  }
116
39
 
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
40
  // 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
41
  // 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
42
  export function islandMessages(source: string, client = false, lives: string[] = [], cause?: string, fallback = false, options: string | false = false, wrapsButtons = false): string {
@@ -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.'
@@ -164,16 +164,10 @@ export function declaredIsland(source: string, script: Span): IslandDeclaration
164
164
  }
165
165
  }
166
166
 
167
- // The role the fence line (`--- client`, `--- island`, `--- static`) or else the `island()` call gives the component, which `client` and `pin` of the parsed file carry whichever wrote it.
168
- export function rolesOf(source: string, script: Span | undefined, fence: Span & { word: string } | undefined): { island: IslandDeclaration | undefined, client: Span | undefined, pin: (Span & { kind: 'island' | 'static' }) | undefined } {
167
+ // The role the `island()` call gives the component, which `client` and `pin` of the parsed file carry.
168
+ export function rolesOf(source: string, script: Span | undefined): { island: IslandDeclaration | undefined, client: Span | undefined, pin: (Span & { kind: 'island' | 'static' }) | undefined } {
169
169
  const island = script === undefined ? undefined : declaredIsland(source, script)
170
170
 
171
- if (fence?.word === 'client')
172
- return { island, client: fence, pin: undefined }
173
-
174
- if (fence?.word === 'island' || fence?.word === 'static')
175
- return { island, client: undefined, pin: { kind: fence.word, start: fence.start, end: fence.end } }
176
-
177
171
  if (island === undefined)
178
172
  return { island, client: undefined, pin: undefined }
179
173
 
@@ -0,0 +1,12 @@
1
+ import type { Lint } from './lints'
2
+
3
+ // The lints of the `islands` group that sit apart from the rest, with the other lints in `LINTS`.
4
+ export const ISLAND_LINTS = {
5
+ 'page-island': {
6
+ level: 'deny',
7
+ group: 'islands',
8
+ summary: 'A page without a `--- server` fence that needs the browser: an `on*`, `bind:` or `ref` in it, a browser value of `kay` such as `signal`, or a live or persisted import. A page renders once on the server and is never an island, so what needs the browser belongs in a component the page renders. Found in the pages of the project, at the thing that makes the page an island; a layout or a page with a `--- server` fence is not reported. It has no fix: moving the code into a component is not an edit that is safe to apply.',
9
+ wrong: '---\nimport { signal } from \'kay\'\n\nconst count = signal(0)\n---\nbutton(onClick={() => count.set(count() + 1)}) {count()}',
10
+ right: '---\nimport Counter from \'../components/counter.kay\'\n---\nCounter',
11
+ },
12
+ } as const satisfies Record<string, Lint>
@@ -1,5 +1,5 @@
1
1
  import type { Diagnostic, Fix, KayFile } from './ast'
2
- import { eolOf, wordEdit } from './deprecated-island'
2
+ import { eolOf } from './island-problems'
3
3
 
4
4
  const STATIC_RENDER = /render\s*:\s*(['"])static\1\s*,?\s*/
5
5
  const EMPTY_SETTINGS = /\(\s*\{\s*\}\s*\)/
@@ -11,8 +11,8 @@ export function islandFence(file: KayFile): Fix | undefined {
11
11
  if (file.server !== undefined || file.client !== undefined || file.pin?.kind === 'island')
12
12
  return undefined
13
13
 
14
- if (file.pin !== undefined)
15
- return { title, edits: file.island === undefined ? [wordEdit(file.scriptLine ?? { start: file.pin.start - 4, end: file.pin.end }, file.pin.end, file.source.slice(0, file.scriptLine?.start ?? 0)), { start: file.script?.start ?? 0, end: file.script?.start ?? 0, text: `island()${eolOf(file.source)}` }] : [{ start: file.island.span.start, end: file.island.span.end, text: file.source.slice(file.island.span.start, file.island.span.end).replace(STATIC_RENDER, '').replace(EMPTY_SETTINGS, '()') }] }
14
+ if (file.pin !== undefined && file.island !== undefined)
15
+ return { title, edits: [{ start: file.island.span.start, end: file.island.span.end, text: file.source.slice(file.island.span.start, file.island.span.end).replace(STATIC_RENDER, '').replace(EMPTY_SETTINGS, '()') }] }
16
16
 
17
17
  if (file.scriptLine === undefined || file.script === undefined)
18
18
  return { title, edits: [{ start: 0, end: 0, text: ['---', 'island()', '---', ''].join(eolOf(file.source)) }] }