@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
@@ -9,12 +9,12 @@ import { RESIZABLE } from '../runtime/image'
9
9
  import { WIDGET_ROLES } from './aria'
10
10
  import { childBlocks, failedBlockOf, FIELD_ATTRIBUTE, FIELD_ELEMENTS, isHead, isSlot, modifiersOf, nodeExpressions, SERVER_IN_ISLAND, serverIslandOf, templateFacts, visitNodes } from './ast'
11
11
  import { componentBindProblem } from './bound-props'
12
- import { deprecatedImage } from './deprecated-image'
13
12
  import { deprecatedLibrary } from './deprecated-library'
14
13
  import { libraryComponents } from './deprecated-ui-props'
15
14
  import { modifierProblems } from './event-modifiers'
16
15
  import { valuesCall } from './form-info'
17
16
  import { shorthandProblems } from './head-shorthand'
17
+ import { hydrateProblem } from './island-problems'
18
18
  import { kayCtxImport } from './script-shared'
19
19
  import { attributeProblem, fieldProblem } from './validate-fields'
20
20
  import { AttributeFixes, PART_NAME, PART_NAME_LIST } from './validate-fixes'
@@ -59,8 +59,6 @@ const RAW_TEXT = new Set(['style', 'script'])
59
59
  const CONTENT_ATTRIBUTES = new Set(['innerHTML', 'textContent', 'innerText', 'children'])
60
60
  // One string literal, the way CSS with braces is written in a template's text.
61
61
  const STRING_LITERAL = /^\s*(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\$]|\\.|\$(?!\{))*`)\s*$/
62
- // A `media(...)` hydrate with a query between its brackets.
63
- const MEDIA_HYDRATE = /^media\(\s*\S.*\)$/s
64
62
  // What only a static parent passes an island.
65
63
  const ISLAND_OPTIONS = new Set(['hydrate', 'persist'])
66
64
  // Elements a keyboard reaches and a screen reader announces as controls; a click handler on any other one needs a control's `role`.
@@ -467,9 +465,6 @@ class Validator {
467
465
  deprecatedLibrary(element, library, span => this.text(span), (span, code, message, details) => this.lint(span, code, message, details))
468
466
  }
469
467
 
470
- if (this.options.check && !element.component && element.name === 'img')
471
- deprecatedImage(element, span => this.text(span), (span, message, details) => this.lint(span, 'deprecated-image-options', message, details))
472
-
473
468
  if (this.options.check && !element.component)
474
469
  this.accessibility(element)
475
470
 
@@ -560,8 +555,8 @@ class Validator {
560
555
  if (element.component && (this.options.island !== undefined || this.options.insideIsland) && (ISLAND_OPTIONS.has(name) || (name === 'render' && attribute.kind === 'static' && attribute.text === 'client')))
561
556
  this.error('attribute-ineffective', attribute.name, `\`${name}\` has no effect inside an island`, { note: 'an island hydrates and lives on as a whole' })
562
557
 
563
- if (element.component && name === 'hydrate' && attribute.kind === 'static' && attribute.text.startsWith('media(') && !MEDIA_HYDRATE.test(attribute.text))
564
- this.error('attribute-invalid', attribute.name, '`hydrate="media(...)"` needs a media query', { help: 'write the query in the brackets: `hydrate="media(max-width: 40rem)"`' })
558
+ if (element.component && name === 'hydrate' && attribute.kind === 'static' && hydrateProblem(attribute.text))
559
+ this.error('attribute-invalid', attribute.name, ...hydrateProblem(attribute.text)!)
565
560
 
566
561
  if (attribute === serverIsland?.attribute)
567
562
  this.serverIsland(serverIsland, failedBlockOf(element, this.src))
@@ -8,7 +8,7 @@ import { setUiLayers } from './build/ui-layers'
8
8
  import { KayError } from './compiler/errors'
9
9
  import { APP_CONTEXT, CONFIG_FILE } from './config'
10
10
  import { resolveConfig } from './config-resolve'
11
- import { CONFIG_GROUPS, invalidConfigValues, isBag, mergeBags, REMOVED_KEYS, unknownConfigKeys } from './config-shape'
11
+ import { CONFIG_GROUPS, CONFIG_KEYS, invalidConfigValues, isBag, mergeBags, REMOVED_KEYS, unknownConfigKeys } from './config-shape'
12
12
  import { NATIVE_PLUGINS } from './native-plugins'
13
13
  import { OLD_PACKAGE_NAME, RENAMED_PACKAGES } from './package-names'
14
14
  import { publicEnvFiles } from './server/env-state'
@@ -171,8 +171,7 @@ function refuseInvalidValues(config: object, where: string): void {
171
171
  // The keys `kay check` and `kay env` read in their own way, refused when they are not the shape they take.
172
172
  function checkedConfig(config: ConfigInput & InternalConfig, where = CONFIG_FILE): void {
173
173
  const { checks, publicEnv } = config
174
- const env = config.envFiles ?? config.env
175
- const key = config.envFiles === undefined ? 'env' : 'envFiles'
174
+ const env = config.envFiles
176
175
 
177
176
  if (publicEnv !== undefined)
178
177
  throw new KayError('config-invalid', `kay: \`publicEnv\` in ${where} is gone: mark the fields an island reads \`s.Public\` in \`defineEnv\` instead`)
@@ -206,7 +205,7 @@ function checkedConfig(config: ConfigInput & InternalConfig, where = CONFIG_FILE
206
205
  const files = Array.isArray(compose) ? compose : [compose]
207
206
 
208
207
  if (typeof env !== 'object' || env === null || Array.isArray(env) || files.some(file => file !== undefined && typeof file !== 'string') || (example !== undefined && typeof example !== 'string'))
209
- throw new KayError('config-invalid', `kay: \`${key}\` in ${where} is \`{ compose, example }\`, each a file name (\`compose\` may be a list of them), \`true\` or \`false\``)
208
+ throw new KayError('config-invalid', `kay: \`envFiles\` in ${where} is \`{ compose, example }\`, each a file name (\`compose\` may be a list of them), \`true\` or \`false\``)
210
209
  }
211
210
 
212
211
  // The config with the catalogs of the libraries the app installs listed before its own extensions, so those and the app's messages win key by key; one an extension of the same name already brings is left alone.
@@ -340,9 +339,20 @@ export async function withConfig<Options extends ConfigInput>(root: string, opti
340
339
  // The options are resolved as the file is, so a code call may pass a list's function or an old key as `kay.config.ts` may.
341
340
  const given = await resolveConfig(options) as KayConfig & Omit<Options, keyof ConfigInput>
342
341
 
342
+ refuseOldOptions(given)
343
+
343
344
  return withUiLayers(root, await withTailwind(root, withPublicFields(root, withAppContext(root, mergeConfig(withLibraryMessages(root, await importConfig(root)), given)))))
344
345
  }
345
346
 
347
+ // The config keys of the options given in code are checked as `kay.config.ts` is, so an old nested key such as `mcp.key` is refused rather than dropped.
348
+ function refuseOldOptions(given: object): void {
349
+ const configPart = Object.fromEntries(Object.entries(given).filter(([key]) => CONFIG_KEYS.has(key)))
350
+ const unknown = unknownConfigKeys(configPart)
351
+
352
+ if (unknown.length > 0)
353
+ throw new KayError('config-invalid', `kay: the options have ${unknown.length === 1 ? 'an option' : 'options'} kay does not know: ${unknown.join('; ')}`)
354
+ }
355
+
346
356
  // `config` is as `kay.config.ts` writes it, so the extensions the options name lie under it rather than the file's.
347
357
  export function mergeConfig<Options extends KayConfig>(config: KayConfig, options: Options): KayConfig & Options {
348
358
  // Options carry keys of their own (`root`, `dev`, `prebuilt`), so only the names kay removed are refused here, as `kay.config.ts` refuses every unknown key.
@@ -1,7 +1,4 @@
1
- import type { ConfigInput, EndpointsConfig, I18nConfig, I18nInput, ImageFormats, ImageLimits, KayConfig, Loadable, ObserveConfig, ObserveInput, RemoteImages } from './config'
2
- import type { McpConfig } from './server/api-modules'
3
- import type { OpenApiConfig } from './server/openapi'
4
- import { KayError } from './compiler/errors'
1
+ import type { ConfigInput, I18nConfig, I18nInput, ImagesInput, KayConfig, Loadable, RemoteImages } from './config'
5
2
  import { isRecord } from './config-rules'
6
3
 
7
4
  // A list as the config gave it: itself, or what the function returns, awaited.
@@ -24,144 +21,34 @@ async function loadKeys<Bag extends object>(bag: Bag | boolean | number | undefi
24
21
  return loaded as Bag
25
22
  }
26
23
 
27
- // The top-level keys of before 1.105 that live in a group of the loaded config now.
28
- const MOVED_KEYS = ['offline', 'search', 'links', 'images', 'fonts', 'favicon', 'manifest', 'publicCache', 'observe', 'health', 'metrics', 'jobs'] as const
29
-
30
24
  const without = <Value extends object>(value: Value): Value => Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== undefined)) as Value
31
25
 
32
- // `images` with its remote hosts loaded and the flat keys of before 1.105 moved into their groups, a key already in its group winning over the old one.
33
- async function resolveImages(images: NonNullable<ConfigInput['images']>): Promise<NonNullable<NonNullable<KayConfig['assets']>['images']>> {
34
- const { remote, remoteMaxSize, remoteTimeout, maxVariants, queue, quality, webp, avif, ...rest } = images
26
+ // `images` with its remote hosts loaded.
27
+ async function resolveImages(images: ImagesInput): Promise<NonNullable<NonNullable<KayConfig['assets']>['images']>> {
28
+ const { remote, ...rest } = images
35
29
  const given: Omit<RemoteImages, 'hosts'> & { hosts?: Loadable<string[]> | undefined } = typeof remote === 'function' || Array.isArray(remote) ? { hosts: remote } : remote ?? {}
36
30
  const hosts = given.hosts === undefined ? undefined : await load(given.hosts)
37
- const grouped = without({ hosts, maxSize: given.maxSize ?? remoteMaxSize, timeout: given.timeout ?? remoteTimeout })
38
- const formats: ImageFormats = without({ quality: rest.formats?.quality ?? quality, webp: rest.formats?.webp ?? webp, avif: rest.formats?.avif ?? avif })
39
- const limits: ImageLimits = without({ variants: rest.limits?.variants ?? maxVariants, queue: rest.limits?.queue ?? queue })
40
-
41
- return {
42
- ...rest,
43
- ...Object.keys(grouped).length > 0 && { remote: grouped },
44
- ...Object.keys(formats).length > 0 && { formats: { ...rest.formats, ...formats } },
45
- ...Object.keys(limits).length > 0 && { limits: { ...rest.limits, ...limits } },
46
- }
47
- }
48
-
49
- // `observe` with its `log` as the group it is since 1.105 (`'json'` is `{ format: 'json' }`, a function `{ sink }`), and the `onError` it held, which is a key of the config now, set aside.
50
- function resolveObserve(observe: ObserveInput): { observe: ObserveConfig, onError: ObserveInput['onError'] } {
51
- const { log, onError, ...rest } = observe
52
- const named = log === 'json' ? { format: 'json' as const } : log
53
- const grouped = typeof named === 'function' ? { sink: named } : named
54
-
55
- return { observe: { ...rest, ...grouped !== undefined && { log: grouped } }, onError }
56
- }
57
-
58
- // `client` with the `links`, `offline` and `search` the config held at its top level before 1.105, a key already in `client` winning over the old one.
59
- function resolveClient(config: ConfigInput): KayConfig['client'] {
60
- const { offline, search, links } = config
61
- const moved = without({ offline, search, links })
62
-
63
- return config.client === undefined && Object.keys(moved).length === 0 ? undefined : { ...moved, ...without(config.client ?? {}) }
64
- }
31
+ const grouped = without({ hosts, maxSize: given.maxSize, timeout: given.timeout })
65
32
 
66
- // `assets` with the `images`, `fonts`, `favicon`, `manifest` and `publicCache` the config held at its top level before 1.105, a key already in `assets` winning over the old one, and the images resolved.
67
- async function resolveAssets(config: ConfigInput): Promise<KayConfig['assets']> {
68
- const { images, fonts, favicon, manifest, publicCache } = config
69
- const moved = without({ images, fonts, favicon, manifest, publicCache })
70
- const given = without(config.assets ?? {})
71
- const merged = { ...moved, ...given }
72
-
73
- if (Object.keys(merged).length === 0)
74
- return config.assets === undefined ? undefined : {}
75
-
76
- const { images: unresolved, ...rest } = merged
77
-
78
- return { ...rest, ...unresolved !== undefined && { images: await resolveImages(unresolved) } }
79
- }
80
-
81
- // `ops` with the `observe`, `health`, `metrics` and `jobs` the config held at its top level before 1.105, a key already in `ops` winning over the old one, and the `onError` an `observe` held set aside.
82
- function resolveOps(config: ConfigInput): { ops: KayConfig['ops'], onError: ObserveInput['onError'], paths: EndpointsConfig } {
83
- const merged = { ...without({ observe: config.observe, health: config.health, metrics: config.metrics, jobs: config.jobs }), ...without(config.ops ?? {}) }
84
-
85
- if (Object.keys(merged).length === 0)
86
- return { ops: config.ops === undefined ? undefined : {}, onError: undefined, paths: {} }
87
-
88
- const { observe: given, health, metrics, jobs, ...rest } = merged
89
- const resolved = given === undefined ? undefined : resolveObserve(given)
90
- const [kept, paths] = [takePath(health), takePath(metrics), takePath(jobs)].reduce<[Record<string, unknown>, EndpointsConfig]>(([bags, at], [bag, path], index) => {
91
- const name = (['health', 'metrics', 'jobs'] as const)[index]!
92
-
93
- return [{ ...bags, ...bag !== undefined && { [name]: bag } }, { ...at, ...path !== undefined && { [name]: path } }]
94
- }, [{}, {}])
95
-
96
- return { ops: { ...rest, ...kept, ...resolved && { observe: resolved.observe } }, onError: resolved?.onError, paths }
33
+ return { ...rest, ...Object.keys(grouped).length > 0 && { remote: grouped } }
97
34
  }
98
35
 
99
- // A bag without the `path` it held before 1.105, which is a key of `endpoints` since, and that path.
100
- function takePath<Bag>(bag: Bag): [Bag, string | undefined] {
101
- if (!isRecord(bag) || !('path' in bag))
102
- return [bag, undefined]
36
+ // `assets` with its images resolved.
37
+ async function resolveAssets(assets: ConfigInput['assets']): Promise<KayConfig['assets']> {
38
+ if (assets?.images === undefined)
39
+ return assets as KayConfig['assets']
103
40
 
104
- const { path, ...rest } = bag
41
+ const { images, ...rest } = assets
105
42
 
106
- // Whatever it is, so the boot refuses one that is no path.
107
- return [rest as Bag, path as string | undefined]
43
+ return { ...rest, images: await resolveImages(images) }
108
44
  }
109
45
 
110
- // `endpoints` with the paths the bags held before 1.105 (`serve.apiPrefix`, the `path` of `openapi`, `mcp`, `health`, `metrics` and `jobs`, the `referencePath` of `openapi`), a key already in `endpoints` winning over the old one, and the bags without them.
111
- function resolveEndpoints(config: ConfigInput, opsPaths: EndpointsConfig, mcp: ConfigInput['mcp']): { endpoints: KayConfig['endpoints'], serve: KayConfig['serve'], openapi: KayConfig['openapi'], mcp: KayConfig['mcp'] } {
112
- const { apiPrefix, ...serve } = config.serve ?? {}
113
- const [bareMcp, mcpAt] = takePath(mcp)
114
- const { path: openapiAt, referencePath, ...openapi } = isRecord(config.openapi) ? config.openapi : {} as Record<string, never>
115
- const written = isRecord(config.openapi)
116
- const reference = referencePath !== undefined && openapi.reference === true ? { path: referencePath } : openapi.reference
117
- const moved: EndpointsConfig = without({ api: apiPrefix, openapi: openapiAt as string | undefined, mcp: mcpAt, ...opsPaths })
118
- const merged = { ...moved, ...without(config.endpoints ?? {}) }
119
-
120
- return {
121
- endpoints: Object.keys(merged).length === 0 ? config.endpoints : merged,
122
- serve: config.serve === undefined ? undefined : serve,
123
- openapi: written ? { ...openapi, ...reference !== undefined && { reference } } as OpenApiConfig : config.openapi,
124
- mcp: bareMcp,
125
- }
126
- }
127
-
128
- // `i18n` with its paths loaded and the `defaultLocale`, `prefixDefault` and `domains` of before 1.105 as `default` and `mode`, a key already in its new place winning over the old one.
46
+ // `i18n` with its paths loaded.
129
47
  async function resolveI18n(i18n: I18nInput | undefined): Promise<I18nConfig | undefined> {
130
- const loaded = await loadKeys(i18n, ['paths'])
131
-
132
- if (!isRecord(loaded))
133
- return loaded as undefined
134
-
135
- const { defaultLocale, prefixDefault, domains, default: named, mode, ...rest } = loaded as Omit<I18nInput, 'paths'> & { paths?: I18nConfig['paths'] }
136
-
137
- if (mode === undefined && domains !== undefined && prefixDefault === true)
138
- throw new KayError('locales-invalid', 'kay: i18n gives domains or prefixDefault, not both: with domains a locale has no prefix')
139
-
140
- const chosen = mode ?? (domains === undefined ? prefixed(prefixDefault) : { domains })
141
- const first = named ?? defaultLocale
142
-
143
- return { ...rest, default: first as string, ...chosen !== undefined && { mode: chosen } }
48
+ return await loadKeys(i18n, ['paths']) as I18nConfig | undefined
144
49
  }
145
50
 
146
- // `proxy` with the header a string `key` named before 1.105 as `{ header }`.
147
- function resolveProxy(proxy: ConfigInput['proxy']): KayConfig['proxy'] {
148
- if (!isRecord(proxy) || typeof proxy.key !== 'string')
149
- return proxy as KayConfig['proxy']
150
-
151
- return { ...proxy, key: { header: proxy.key } } as KayConfig['proxy']
152
- }
153
-
154
- // `mcp` with the `key` of before 1.105 as `token`, a `token` already written winning over it.
155
- function resolveMcp(mcp: ConfigInput['mcp']): KayConfig['mcp'] {
156
- if (!isRecord(mcp) || !('key' in mcp))
157
- return mcp
158
-
159
- const { key, ...rest } = mcp
160
-
161
- return key === undefined || key === false || rest.token !== undefined ? rest : { ...rest, token: key as McpConfig['token'] }
162
- }
163
-
164
- // The config `kay.config.ts` wrote as the `KayConfig` the server reads: each list that a function gave loaded once, the old flat keys of `images`, the `onStart` hook and `observe`'s `onError` and `log` in the places they have since 1.105. Called as the config loads, so `kay dev` calls the functions again after a change to the file.
51
+ // The config `kay.config.ts` wrote as the `KayConfig` the server reads: each list that a function gave loaded once. Called as the config loads, so `kay dev` calls the functions again after a change to the file.
165
52
  export async function resolveConfig(config: ConfigInput): Promise<KayConfig> {
166
53
  const [security, proxy, robots, i18n, redirects, assets] = await Promise.all([
167
54
  loadKeys(config.security, ['hosts']),
@@ -169,19 +56,12 @@ export async function resolveConfig(config: ConfigInput): Promise<KayConfig> {
169
56
  loadKeys(config.robots, ['disallow', 'allow']),
170
57
  resolveI18n(config.i18n),
171
58
  config.redirects === undefined ? undefined : load(config.redirects),
172
- resolveAssets(config),
59
+ resolveAssets(config.assets),
173
60
  ])
174
61
  const cors = config.cors === undefined ? undefined : await loadKeys(config.cors, ['origins'])
175
- const { onStart, ...kept } = config
176
- // An extension's config is written as `kay.config.ts` is, so its keys of before 1.105 move as the app's do.
62
+ // An extension's config is written as `kay.config.ts` is, so its lists load as the app's do.
177
63
  const extensions = config.extensions === undefined ? undefined : await Promise.all(config.extensions.map(async extension => extension.config === undefined ? extension : { ...extension, config: await resolveConfig(extension.config) }))
178
-
179
- for (const key of MOVED_KEYS)
180
- delete kept[key]
181
-
182
- const { ops, onError, paths } = resolveOps(config)
183
- const routes = resolveEndpoints(config, paths, resolveMcp(config.mcp))
184
- const resolved: Record<string, unknown> = { ...kept, ...extensions !== undefined && { extensions }, security, proxy: resolveProxy(proxy), ...routes, robots, i18n, redirects, assets, ops, cors, client: resolveClient(config), onListen: config.onListen ?? onStart, onError: config.onError ?? onError }
64
+ const resolved: Record<string, unknown> = { ...config, ...extensions !== undefined && { extensions }, security, proxy, robots, i18n, redirects, assets, cors }
185
65
 
186
66
  for (const key of Object.keys(resolved)) {
187
67
  if (resolved[key] === undefined)
@@ -190,7 +70,3 @@ export async function resolveConfig(config: ConfigInput): Promise<KayConfig> {
190
70
 
191
71
  return resolved
192
72
  }
193
-
194
- function prefixed(prefixDefault: boolean | undefined): 'always' | undefined {
195
- return prefixDefault === true ? 'always' : undefined
196
- }
@@ -1,5 +1,5 @@
1
1
  import type { BudgetConfig } from './build/budget'
2
- import type { ActionsConfig, AssetsConfig, CardConfig, ClientConfig, ConfigInput, CookieDefaults, DeprecatedMcp, DeprecatedOpenApi, DeprecatedPath, DeprecatedServe, DirsConfig, EndpointsConfig, FaviconConfig, HealthConfig, I18nInput, ImageFormats, ImageLimits, ImagesInput, JobsConfig, LimitsConfig, LiveConfig, LogConfig, ManifestConfig, ManifestShareTarget, MarkdownConfig, MetricsConfig, ObserveInput, OfflineConfig, OpsConfig, PreviewConfig, ProxyConfig, RemoteImages, RobotsConfig, SecurityConfig, SeoConfig, ServeConfig, SitemapConfig } from './config'
2
+ import type { ActionsConfig, AssetsConfig, CardConfig, ClientConfig, ConfigInput, CookieDefaults, DirsConfig, EndpointsConfig, FaviconConfig, HealthConfig, I18nInput, ImageFormats, ImageLimits, ImagesInput, JobsConfig, LimitsConfig, LiveConfig, LogConfig, ManifestConfig, ManifestShareTarget, MarkdownConfig, MetricsConfig, ObserveConfig, OfflineConfig, OpsConfig, PreviewConfig, ProxyConfig, RemoteImages, RobotsConfig, SecurityConfig, SeoConfig, ServeConfig, SitemapConfig } from './config'
3
3
  import type { Rule } from './config-rules'
4
4
  import type { McpConfig } from './server/api-modules'
5
5
  import type { OpenApiConfig } from './server/openapi'
@@ -11,38 +11,36 @@ import { nearest } from './nearest'
11
11
  const localized = either(str, map(str))
12
12
  const guardOption = either(fn, list(fn), bag({ load: fn }), lit(false))
13
13
  const SECURITY_KEYS: Record<keyof SecurityConfig, Rule> = { csp: either(bool, map(either(list(str), lit(false)))), reportOnly: map(either(list(str), lit(false))), reports: either(lit(true), str), permissions: map(either(str, list(str), lit(false))), headers: map(either(str, lit(false))), hosts: either(fn, list(str), bool), cookies: either(bool, bag({ httpOnly: bool, sameSite: oneOf('lax', 'strict', 'none'), secure: either(bool, oneOf('auto')), path: str } satisfies Record<keyof CookieDefaults, Rule>)) }
14
- const I18N: Record<keyof I18nInput, Rule> = { locales: list(str), default: str, mode: either(oneOf('prefix', 'always'), bag({ domains: map(str) })), defaultLocale: str, prefixDefault: bool, domains: map(str), paths: either(fn, map(map(str))), messages: str }
15
- const I18N_BAG = bag(I18N, ({ locales, default: named, defaultLocale }, path, out) => {
16
- const chosen = named ?? defaultLocale
17
-
14
+ const I18N: Record<keyof I18nInput, Rule> = { locales: list(str), default: str, mode: either(oneOf('prefix', 'always'), bag({ domains: map(str) })), paths: either(fn, map(map(str))), messages: str }
15
+ const I18N_BAG = bag(I18N, ({ locales, default: chosen }, path, out) => {
18
16
  if (Array.isArray(locales) && typeof chosen === 'string' && !locales.includes(chosen))
19
- out.push(`\`${path}.${named === undefined ? 'defaultLocale' : 'default'}\` is ${JSON.stringify(chosen)}, expected one of its locales: ${locales.map(locale => JSON.stringify(locale)).join(', ')}`)
17
+ out.push(`\`${path}.default\` is ${JSON.stringify(chosen)}, expected one of its locales: ${locales.map(locale => JSON.stringify(locale)).join(', ')}`)
20
18
  })
21
19
  const SEO: Record<keyof SeoConfig, Rule> = { name: localized, titleTemplate: localized, description: localized, image: localized, imageAlt: localized, noindex: bool, twitter: str, locale: localized, themeColor: either(str, bag({ light: str, dark: str })), jsonLd: list(obj) }
22
20
  const DIRS: Record<keyof DirsConfig, Rule> = { routes: str, api: str, public: str }
23
21
  const LIMITS: Record<keyof LimitsConfig, Rule> = { body: bytes, byPath: map(bytes) }
24
- const SERVE: Record<keyof (ServeConfig & DeprecatedServe), Rule> = { apiPrefix: str, compress: bool, compressionDictionary: bool, shutdownTimeout: duration, timeout: either(duration, lit(false)) }
22
+ const SERVE: Record<keyof ServeConfig, Rule> = { compress: bool, compressionDictionary: bool, shutdownTimeout: duration, timeout: either(duration, lit(false)) }
25
23
  const LOG: Record<keyof LogConfig, Rule> = { format: oneOf('text', 'json'), requests: bool, sink: fn }
26
- const OBSERVE: Record<keyof ObserveInput, Rule> = { log: either(bool, oneOf('json'), fn, bag(LOG)), serverTiming: bool, loadBudget: either(duration, lit(false)), requestIdHeader: str, tracer: true, extract: either(fn, lit(false)), onError: fn }
24
+ const OBSERVE: Record<keyof ObserveConfig, Rule> = { log: either(bool, bag(LOG)), serverTiming: bool, loadBudget: either(duration, lit(false)), requestIdHeader: str, tracer: true, extract: either(fn, lit(false)) }
27
25
  const OFFLINE: Record<keyof OfflineConfig, Rule> = { pages: list(str), fallback: str }
28
26
  const LINKS = bag({ outside: oneOf('new-tab', 'same-tab'), schemes: list(str) })
29
27
  const HYDRATION = bag({ visible: str, serverIslands: str })
30
28
  const CLIENT: Record<keyof ClientConfig, Rule> = { navigation: bool, inlineStyles: bool, lateStyles: bool, typography: bool, hydration: HYDRATION, prefetch: either(oneOf('conservative', 'moderate', 'eager'), lit(false)), saveData: bool, pageTimeout: duration, loadingDelay: duration, offline: either(bool, bag(OFFLINE)), search: bool, links: LINKS }
31
29
  const ACTIONS: Record<keyof ActionsConfig, Rule> = { protect: either(lit(false), obj), maxSize: bytes, messages: obj, beforeRun: fn, onSuccess: fn, onError: fn }
32
- const HEALTH: Record<keyof (HealthConfig & DeprecatedPath), Rule> = { path: str, timeout: duration, check: fn }
30
+ const HEALTH: Record<keyof HealthConfig, Rule> = { timeout: duration, check: fn }
33
31
  const SECRET = either(str, bag({ env: str, file: str }))
34
- const PROXY: Record<keyof ProxyConfig, Rule> = { hops: num, header: str, trusted: either(fn, list(str)), trustPrivate: lit(false), key: either(str, bag({ header: str, secret: SECRET })), open: list(str) }
32
+ const PROXY: Record<keyof ProxyConfig, Rule> = { hops: num, header: str, trusted: either(fn, list(str)), trustPrivate: lit(false), key: bag({ header: str, secret: SECRET }), open: list(str) }
35
33
  const ENDPOINTS: Record<keyof EndpointsConfig, Rule> = { api: str, openapi: str, mcp: str, health: str, metrics: str, jobs: str }
36
- const OPENAPI: Record<keyof (OpenApiConfig & DeprecatedOpenApi), Rule> = { title: str, version: str, path: str, reference: either(bool, bag({ path: str })), referencePath: str, dev: bool }
37
- const MCP: Record<keyof (McpConfig & DeprecatedMcp), Rule> = { path: str, rateLimit: either(bool, obj), token: either(lit(true), SECRET), key: either(bool, str, bag({ file: str })), instructions: str }
34
+ const OPENAPI: Record<keyof OpenApiConfig, Rule> = { title: str, version: str, reference: either(bool, bag({ path: str })), dev: bool }
35
+ const MCP: Record<keyof McpConfig, Rule> = { rateLimit: either(bool, obj), token: either(lit(true), SECRET), instructions: str }
38
36
  const SITEMAP: Record<keyof SitemapConfig, Rule> = { ttl: duration }
39
37
  const ROBOTS: Record<keyof RobotsConfig, Rule> = { disallow: either(fn, list(str)), allow: either(fn, list(str)) }
40
38
  const PREVIEW: Record<keyof PreviewConfig, Rule> = { secret: str, maxAge: duration, sharedNotBefore: fn }
41
39
  // The limit of kay's own routes: `RateLimit` but for `key`, as they count the client's address.
42
40
  const KAY_ROUTE_LIMIT: Record<string, Rule> = { max: num, window: duration, store: obj, onLimit: fn }
43
41
  const LIVE: Record<keyof LiveConfig, Rule> = { connections: num, rateLimit: either(bool, bag(KAY_ROUTE_LIMIT)) }
44
- const JOBS: Record<keyof (JobsConfig & DeprecatedPath), Rule> = { guards: guardOption, guard: guardOption, path: str }
45
- const METRICS: Record<keyof (MetricsConfig & DeprecatedPath), Rule> = { path: str, token: either(lit(true), SECRET) }
42
+ const JOBS: Record<keyof JobsConfig, Rule> = { guards: guardOption }
43
+ const METRICS: Record<keyof MetricsConfig, Rule> = { token: either(lit(true), SECRET) }
46
44
  const BUDGET: Record<keyof BudgetConfig, Rule> = { js: bytes, css: bytes, weight: bytes, grade: oneOf('A', 'B', 'C', 'D', 'E', 'F', 'G') }
47
45
  const FAVICON: Record<keyof FaviconConfig, Rule> = { image: str, svg: str }
48
46
  const MANIFEST: Record<keyof ManifestConfig, Rule> = { shortName: str, themeColor: either(str, bag({ light: str, dark: str })), backgroundColor: str, display: oneOf('fullscreen', 'standalone', 'minimal-ui', 'browser'), orientation: oneOf('any', 'natural', 'landscape', 'landscape-primary', 'landscape-secondary', 'portrait', 'portrait-primary', 'portrait-secondary'), startUrl: str, scope: str, maskable: str, shortcuts: list(obj), shareTarget: bag({ action: str, files: list(str), params: bag({ title: str, text: str, url: str, files: str }) } satisfies Record<keyof ManifestShareTarget, Rule>) }
@@ -52,7 +50,7 @@ const AVIF = either(bool, bag({ quality: num }))
52
50
  const REMOTE_IMAGES: Record<keyof RemoteImages, Rule> = { hosts: either(fn, list(str)), maxSize: bytes, timeout: duration }
53
51
  const IMAGE_FORMATS: Record<keyof ImageFormats, Rule> = { quality: num, webp: bag({ quality: num }), avif: AVIF }
54
52
  const IMAGE_LIMITS: Record<keyof ImageLimits, Rule> = { variants: either(num, lit(false)), queue: either(num, lit(false)) }
55
- const IMAGES: Record<keyof ImagesInput, Rule> = { ttl: duration, dirs: map(str), remote: either(fn, list(str), bag(REMOTE_IMAGES)), formats: bag(IMAGE_FORMATS), limits: bag(IMAGE_LIMITS), remoteMaxSize: bytes, remoteTimeout: duration, rateLimit: either(bool, bag(KAY_ROUTE_LIMIT)), maxVariants: either(num, lit(false)), queue: either(num, lit(false)), quality: num, webp: bag({ quality: num }), widths: list(num), avif: AVIF, maxDensity: numOrInfinity, placeholder: bool, aspects: list(str), card: bag(CARD), resolve: fn, guards: guardOption, guard: guardOption }
53
+ const IMAGES: Record<keyof ImagesInput, Rule> = { ttl: duration, dirs: map(str), remote: either(fn, list(str), bag(REMOTE_IMAGES)), formats: bag(IMAGE_FORMATS), limits: bag(IMAGE_LIMITS), rateLimit: either(bool, bag(KAY_ROUTE_LIMIT)), widths: list(num), maxDensity: numOrInfinity, placeholder: bool, aspects: list(str), card: bag(CARD), resolve: fn, guards: guardOption }
56
54
  const ASSETS: Record<keyof AssetsConfig, Rule> = { images: bag(IMAGES), fonts: list(obj), favicon: either(str, bool, bag(FAVICON)), manifest: bag(MANIFEST), publicCache: map(duration) }
57
55
  const OPS: Record<keyof OpsConfig, Rule> = { observe: bag(OBSERVE), health: either(bool, bag(HEALTH)), metrics: either(bool, bag(METRICS)), jobs: bag(JOBS) }
58
56
  const CORS = bag({ origins: either(oneOf('*'), list(str), fn), credentials: bool, expose: list(str), headers: list(str), maxAge: duration })
@@ -63,18 +61,15 @@ const CONFIG: Record<keyof ConfigInput, Rule> = {
63
61
  endpoints: bag(ENDPOINTS),
64
62
  assets: bag(ASSETS),
65
63
  ops: bag(OPS),
66
- observe: bag(OBSERVE),
67
64
  client: bag(CLIENT),
68
65
  actions: bag(ACTIONS),
69
66
  beforeRequest: fn,
70
67
  onResponse: fn,
71
68
  onListen: fn,
72
- onStart: fn,
73
69
  onStop: fn,
74
70
  onError: fn,
75
71
 
76
72
  i18n: I18N_BAG,
77
- publicCache: map(duration),
78
73
  minify: bool,
79
74
  lang: str,
80
75
  site: str,
@@ -82,31 +77,20 @@ const CONFIG: Record<keyof ConfigInput, Rule> = {
82
77
  robots: either(bool, bag(ROBOTS)),
83
78
  sitemap: either(bool, bag(SITEMAP)),
84
79
  head: list(obj),
85
- images: bag(IMAGES),
86
80
  budget: bag(BUDGET),
87
- favicon: either(str, bool, bag(FAVICON)),
88
- manifest: bag(MANIFEST),
89
81
  entry: str,
90
- offline: either(bool, bag(OFFLINE)),
91
- search: bool,
92
- fonts: list(obj),
93
82
  security: either(bool, bag(SECURITY_KEYS)),
94
- proxy: either(bool, num, bag(PROXY)),
95
- requireGuards: bool,
83
+ proxy: either(bool, bag(PROXY)),
96
84
  guards: bag({ default: oneOf('open', 'closed') }),
97
85
  cors: CORS,
98
86
  openapi: either(bool, bag(OPENAPI)),
99
87
  mcp: either(bool, bag(MCP)),
100
- health: either(bool, bag(HEALTH)),
101
- metrics: either(bool, bag(METRICS)),
102
- jobs: bag(JOBS),
103
88
  rewrite: true,
104
89
  redirects: true,
105
90
  runtimeRedirects: bag({ hosts: list(str) }),
106
91
  live: bag(LIVE),
107
92
  timeZone: str,
108
93
  base: str,
109
- links: LINKS,
110
94
  trailingSlash: oneOf('never', 'always', 'ignore'),
111
95
  contentConfig: str,
112
96
  markdown: bag(MARKDOWN),
@@ -116,13 +100,24 @@ const CONFIG: Record<keyof ConfigInput, Rule> = {
116
100
  secret: either(str, list(str)),
117
101
  preview: either(bool, bag(PREVIEW)),
118
102
  store: true,
119
- env: true,
120
103
  envFiles: true,
121
104
  checks: true,
122
105
  extensions: list(obj),
123
106
  }
124
107
 
125
- // The names a config key had before 1.88 (`fileStore` before 1.87) and no longer has, each with where it lives now: one is reported as an unknown key naming its replacement.
108
+ // The keys inside a group that moved before 1.105, by their path, each with where it lives now.
109
+ const REMOVED_NESTED: Record<string, string> = {
110
+ 'mcp.key': 'mcp.token',
111
+ 'mcp.path': 'endpoints.mcp',
112
+ 'openapi.path': 'endpoints.openapi',
113
+ 'openapi.referencePath': 'openapi.reference.path',
114
+ 'serve.apiPrefix': 'endpoints.api',
115
+ 'i18n.defaultLocale': 'i18n.default',
116
+ 'i18n.prefixDefault': 'i18n.mode: \'always\'',
117
+ 'i18n.domains': 'i18n.mode: { domains }',
118
+ }
119
+
120
+ // The names a config key had before 1.88 (`fileStore` before 1.87) or before 1.105 and no longer has, each with where it lives now: one is reported as an unknown key naming its replacement.
126
121
  export const REMOVED_KEYS: Record<string, string> = {
127
122
  routes: 'dirs.routes',
128
123
  api: 'dirs.api',
@@ -151,12 +146,26 @@ export const REMOVED_KEYS: Record<string, string> = {
151
146
  hydration: 'client.hydration',
152
147
  prefetch: 'client.prefetch',
153
148
  saveData: 'client.saveData',
149
+ onStart: 'onListen',
150
+ offline: 'client.offline',
151
+ search: 'client.search',
152
+ links: 'client.links',
153
+ images: 'assets.images',
154
+ fonts: 'assets.fonts',
155
+ favicon: 'assets.favicon',
156
+ manifest: 'assets.manifest',
157
+ publicCache: 'assets.publicCache',
158
+ observe: 'ops.observe',
159
+ health: 'ops.health',
160
+ metrics: 'ops.metrics',
161
+ jobs: 'ops.jobs',
162
+ env: 'envFiles',
154
163
  }
155
164
 
156
165
  // The keys the config takes at its top level, which `kay check` tells from the other options of `pages()` and `testSite()`.
157
166
  export const CONFIG_KEYS: ReadonlySet<string> = new Set(Object.keys(CONFIG))
158
167
 
159
- export const CONFIG_GROUPS = ['dirs', 'limits', 'serve', 'endpoints', 'observe', 'client', 'assets', 'ops'] as const
168
+ export const CONFIG_GROUPS = ['dirs', 'limits', 'serve', 'endpoints', 'client', 'assets', 'ops'] as const
160
169
 
161
170
  export const isBag = isRecord
162
171
 
@@ -212,7 +221,8 @@ export function unknownConfigKeys(config: object): string[] {
212
221
  }
213
222
 
214
223
  const found = nearest(key, Object.keys(known))
215
- const removed = path === '' && Object.hasOwn(REMOVED_KEYS, key) ? REMOVED_KEYS[key] : undefined
224
+ const table = path === '' ? REMOVED_KEYS : REMOVED_NESTED
225
+ const removed = Object.hasOwn(table, `${path}${key}`) ? table[`${path}${key}`] : undefined
216
226
  // A typo of a name that moved is offered with where it lives now.
217
227
  const oldName = removed === undefined && found === undefined && path === '' ? nearest(key, Object.keys(REMOVED_KEYS)) : undefined
218
228
  let hint = ''