@kayjs/kay 1.108.0 → 1.110.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (595) hide show
  1. package/dist/eslint.js +2093 -3774
  2. package/editors/zed/extension.toml +2 -2
  3. package/llms/action-protection.md +1 -1
  4. package/llms/actions-from-islands.md +5 -5
  5. package/llms/actions-refused-fields.md +4 -4
  6. package/llms/api-from-islands.md +6 -6
  7. package/llms/browser-only.md +2 -2
  8. package/llms/cdn-caching.md +1 -1
  9. package/llms/checks.md +1 -1
  10. package/llms/code-lints.md +1 -2
  11. package/llms/component-library-conventions.md +1 -1
  12. package/llms/components.md +5 -5
  13. package/llms/deprecated-lints.md +2 -7
  14. package/llms/effects.md +1 -1
  15. package/llms/errors.md +2 -2
  16. package/llms/events.md +1 -1
  17. package/llms/guards.md +1 -1
  18. package/llms/head.md +1 -1
  19. package/llms/hooks.md +2 -2
  20. package/llms/images.md +1 -1
  21. package/llms/island-and-form-lints.md +4 -2
  22. package/llms/island-sources.md +1 -1
  23. package/llms/islands-state-to-ids.md +2 -2
  24. package/llms/islands.md +8 -4
  25. package/llms/lints.md +1 -1
  26. package/llms/live-values.md +4 -4
  27. package/llms/local-collections.md +1 -1
  28. package/llms/locales.md +1 -1
  29. package/llms/mcp.md +2 -2
  30. package/llms/metrics.md +1 -1
  31. package/llms/navigation-from-code.md +7 -7
  32. package/llms/navigation.md +4 -2
  33. package/llms/prerendering.md +1 -0
  34. package/llms/production.md +2 -2
  35. package/llms/project-new-and-add.md +1 -1
  36. package/llms/project.md +4 -4
  37. package/llms/proxy-and-security.md +1 -1
  38. package/llms/queues.md +1 -1
  39. package/llms/rate-limits.md +4 -4
  40. package/llms/rendering.md +1 -1
  41. package/llms/server-islands.md +2 -2
  42. package/llms/server.md +1 -1
  43. package/llms/stores.md +1 -1
  44. package/llms/styles-and-assets.md +1 -1
  45. package/llms/templates-elements-slots-snippets.md +2 -2
  46. package/llms/testing-mount.md +49 -0
  47. package/llms/testing.md +4 -45
  48. package/llms/upgrading-1-105-config.md +13 -13
  49. package/llms/upgrading-archive.md +64 -74
  50. package/llms/upgrading.md +92 -70
  51. package/llms/whats-new.md +24 -0
  52. package/llms.txt +5 -6
  53. package/package.json +6 -10
  54. package/src/build/route-sizes.ts +2 -3
  55. package/src/build/variants.ts +132 -18
  56. package/src/check/browser-global-reads.ts +2 -2
  57. package/src/check/config-objects.ts +1 -1
  58. package/src/check/diagnose.ts +0 -22
  59. package/src/check/env-types.ts +1 -1
  60. package/src/check/export-homes.ts +1 -1
  61. package/src/check/guards.ts +3 -3
  62. package/src/check/index.ts +2 -7
  63. package/src/check/moved-keys.ts +1 -1
  64. package/src/check/project.ts +6 -7
  65. package/src/check/schema-builders.ts +125 -26
  66. package/src/check/shadow-types.ts +0 -86
  67. package/src/commands/check.ts +2 -2
  68. package/src/commands/env.ts +25 -3
  69. package/src/commands/upgrade.ts +2 -1
  70. package/src/compiler/allow-comments.ts +38 -2
  71. package/src/compiler/ast.ts +21 -19
  72. package/src/compiler/browser.ts +2 -14
  73. package/src/compiler/class-items.ts +16 -0
  74. package/src/compiler/codegen.ts +10 -10
  75. package/src/compiler/deprecated-library.ts +0 -12
  76. package/src/compiler/deprecated-lints-1-106.ts +2 -2
  77. package/src/compiler/deprecated-lints.ts +3 -495
  78. package/src/compiler/deprecated-ui-props.ts +5 -5
  79. package/src/compiler/errors.ts +2 -2
  80. package/src/compiler/fence-checks.ts +2 -121
  81. package/src/compiler/hand-parts.ts +83 -0
  82. package/src/compiler/helper-imports.ts +2 -2
  83. package/src/compiler/image-attributes.ts +1 -3
  84. package/src/compiler/index.ts +23 -23
  85. package/src/compiler/island-arguments.ts +17 -95
  86. package/src/compiler/island-cause.ts +7 -7
  87. package/src/compiler/island-declaration.ts +2 -8
  88. package/src/compiler/island-lints.ts +19 -0
  89. package/src/compiler/island-marker.ts +3 -3
  90. package/src/compiler/island-problems.ts +25 -0
  91. package/src/compiler/items.ts +12 -0
  92. package/src/compiler/jsx-class.ts +1 -25
  93. package/src/compiler/jsx.ts +7 -6
  94. package/src/compiler/kay-exports.ts +0 -2
  95. package/src/compiler/link-flags.ts +9 -38
  96. package/src/compiler/lints.ts +10 -18
  97. package/src/compiler/markup.ts +33 -41
  98. package/src/compiler/module-signals.ts +2 -2
  99. package/src/compiler/names.ts +1 -1
  100. package/src/compiler/page-settings.ts +11 -0
  101. package/src/compiler/parser.ts +6 -8
  102. package/src/compiler/plan.ts +1 -3
  103. package/src/compiler/removed-lints.ts +90 -0
  104. package/src/compiler/rewrite.ts +3 -18
  105. package/src/compiler/script-server.ts +8 -3
  106. package/src/compiler/signal-from-prop.ts +141 -0
  107. package/src/compiler/template-reads.ts +16 -0
  108. package/src/compiler/validate.ts +3 -8
  109. package/src/config-loader.ts +14 -4
  110. package/src/config-resolve.ts +18 -142
  111. package/src/config-shape.ts +44 -34
  112. package/src/config.ts +10 -114
  113. package/src/dev/preload.ts +4 -1
  114. package/src/lsp/server.ts +4 -0
  115. package/src/migrate/markup.ts +4 -1
  116. package/src/runtime/action-call.ts +0 -8
  117. package/src/runtime/action-encode.ts +26 -0
  118. package/src/runtime/action-error.ts +3 -11
  119. package/src/runtime/action-protection.ts +2 -2
  120. package/src/runtime/action-run.ts +2 -27
  121. package/src/runtime/action-shared.ts +14 -37
  122. package/src/runtime/action-stream.ts +0 -1
  123. package/src/runtime/action.ts +1 -1
  124. package/src/runtime/call-result.ts +2 -10
  125. package/src/runtime/checks.ts +25 -13
  126. package/src/runtime/client.ts +7 -11
  127. package/src/runtime/core.ts +5 -23
  128. package/src/runtime/dom.ts +1 -1
  129. package/src/runtime/html.ts +1 -1
  130. package/src/runtime/i18n.client.ts +1 -4
  131. package/src/runtime/i18n.server.ts +1 -4
  132. package/src/runtime/i18n.ts +3 -3
  133. package/src/runtime/image.ts +2 -19
  134. package/src/runtime/index.ts +3 -3
  135. package/src/runtime/island.server.ts +56 -13
  136. package/src/runtime/live-resource.server.ts +0 -1
  137. package/src/runtime/live-value.server.ts +2 -2
  138. package/src/runtime/live-value.shared.ts +7 -20
  139. package/src/runtime/live.ts +1 -12
  140. package/src/runtime/local-types.ts +1 -11
  141. package/src/runtime/local.ts +4 -14
  142. package/src/runtime/navigate-api.ts +2 -5
  143. package/src/runtime/navigate.ts +9 -0
  144. package/src/runtime/navigation-state.ts +0 -12
  145. package/src/runtime/navigation.ts +5 -1
  146. package/src/runtime/page-swap.ts +8 -8
  147. package/src/runtime/persist.ts +11 -3
  148. package/src/runtime/persisted.ts +4 -30
  149. package/src/runtime/presence.ts +6 -7
  150. package/src/runtime/query-param.ts +20 -12
  151. package/src/runtime/reactive.ts +3 -1
  152. package/src/runtime/refuse.ts +3 -17
  153. package/src/runtime/store-base.ts +4 -6
  154. package/src/runtime/swap-fetch.ts +1 -1
  155. package/src/runtime/swap-flight.ts +10 -10
  156. package/src/runtime/swap-kept.ts +69 -29
  157. package/src/runtime/swap-morph.ts +49 -9
  158. package/src/runtime/text-hash.ts +17 -0
  159. package/src/runtime/uid.server.ts +6 -4
  160. package/src/runtime/values.ts +52 -23
  161. package/src/runtime/with-query.ts +9 -0
  162. package/src/server/action-hooks.ts +8 -8
  163. package/src/server/actions.ts +13 -14
  164. package/src/server/api-modules.ts +2 -3
  165. package/src/server/app-stages.ts +15 -33
  166. package/src/server/app.ts +10 -5
  167. package/src/server/auth-mails.ts +0 -2
  168. package/src/server/env-state.ts +40 -10
  169. package/src/server/flash.ts +1 -1
  170. package/src/server/guard-requirement.ts +4 -4
  171. package/src/server/image.ts +2 -2
  172. package/src/server/index.ts +0 -2
  173. package/src/server/job-context.ts +3 -3
  174. package/src/server/jobs-page.ts +1 -1
  175. package/src/server/jobs.ts +5 -9
  176. package/src/server/kept-exports.ts +0 -2
  177. package/src/server/kv.ts +11 -14
  178. package/src/server/library.ts +1 -3
  179. package/src/server/live.ts +2 -2
  180. package/src/server/mcp.ts +3 -9
  181. package/src/server/metrics.ts +2 -4
  182. package/src/server/page-settings.ts +10 -19
  183. package/src/server/prerender.ts +19 -2
  184. package/src/server/protection.ts +15 -18
  185. package/src/server/queue.ts +3 -6
  186. package/src/server/rate-limit.ts +0 -3
  187. package/src/server/render-document.ts +9 -7
  188. package/src/server/render.ts +1 -1
  189. package/src/server/routes.ts +7 -3
  190. package/src/server/scope.ts +3 -2
  191. package/src/server/session.ts +5 -6
  192. package/src/server/setup.ts +1 -1
  193. package/src/server/signals.ts +17 -7
  194. package/src/server/signed.ts +1 -3
  195. package/src/server/source.ts +20 -4
  196. package/src/server/speculation.ts +1 -1
  197. package/src/server/storage.ts +3 -8
  198. package/src/server/validate.ts +1 -1
  199. package/src/server/vitals.ts +1 -3
  200. package/src/server/work-scope.ts +2 -4
  201. package/src/server/work.ts +1 -1
  202. package/src/server/workflow.ts +1 -1
  203. package/src/test/index.ts +2 -1
  204. package/src/test/site-actions.ts +16 -6
  205. package/src/test/site-keys.ts +10 -15
  206. package/src/test/site-socket.ts +1 -2
  207. package/src/test/site-types.ts +0 -8
  208. package/types/build/route-sizes.d.ts.map +1 -1
  209. package/types/build/variants.d.ts +9 -1
  210. package/types/build/variants.d.ts.map +1 -1
  211. package/types/check/diagnose.d.ts.map +1 -1
  212. package/types/check/index.d.ts +1 -2
  213. package/types/check/index.d.ts.map +1 -1
  214. package/types/check/project.d.ts.map +1 -1
  215. package/types/check/schema-builders.d.ts.map +1 -1
  216. package/types/check/shadow-types.d.ts.map +1 -1
  217. package/types/commands/env.d.ts.map +1 -1
  218. package/types/commands/upgrade.d.ts.map +1 -1
  219. package/types/compiler/allow-comments.d.ts +2 -0
  220. package/types/compiler/allow-comments.d.ts.map +1 -1
  221. package/types/compiler/ast.d.ts +1 -2
  222. package/types/compiler/ast.d.ts.map +1 -1
  223. package/types/compiler/browser.d.ts.map +1 -1
  224. package/types/compiler/class-items.d.ts +7 -0
  225. package/types/compiler/class-items.d.ts.map +1 -0
  226. package/types/compiler/deprecated-library.d.ts.map +1 -1
  227. package/types/compiler/deprecated-lints-1-106.d.ts +2 -2
  228. package/types/compiler/deprecated-lints-1-106.d.ts.map +1 -1
  229. package/types/compiler/deprecated-lints.d.ts +2 -553
  230. package/types/compiler/deprecated-lints.d.ts.map +1 -1
  231. package/types/compiler/deprecated-ui-props.d.ts +1 -8
  232. package/types/compiler/deprecated-ui-props.d.ts.map +1 -1
  233. package/types/compiler/errors.d.ts +2 -2
  234. package/types/compiler/errors.d.ts.map +1 -1
  235. package/types/compiler/fence-checks.d.ts +0 -1
  236. package/types/compiler/fence-checks.d.ts.map +1 -1
  237. package/types/compiler/hand-parts.d.ts +10 -0
  238. package/types/compiler/hand-parts.d.ts.map +1 -0
  239. package/types/compiler/image-attributes.d.ts +0 -1
  240. package/types/compiler/image-attributes.d.ts.map +1 -1
  241. package/types/compiler/index.d.ts.map +1 -1
  242. package/types/compiler/island-arguments.d.ts +7 -11
  243. package/types/compiler/island-arguments.d.ts.map +1 -1
  244. package/types/compiler/island-cause.d.ts +1 -1
  245. package/types/compiler/island-cause.d.ts.map +1 -1
  246. package/types/compiler/island-declaration.d.ts +1 -3
  247. package/types/compiler/island-declaration.d.ts.map +1 -1
  248. package/types/compiler/island-lints.d.ts +17 -0
  249. package/types/compiler/island-lints.d.ts.map +1 -0
  250. package/types/compiler/island-problems.d.ts +7 -0
  251. package/types/compiler/island-problems.d.ts.map +1 -0
  252. package/types/compiler/items.d.ts +1 -0
  253. package/types/compiler/items.d.ts.map +1 -1
  254. package/types/compiler/jsx-class.d.ts +1 -2
  255. package/types/compiler/jsx-class.d.ts.map +1 -1
  256. package/types/compiler/jsx.d.ts.map +1 -1
  257. package/types/compiler/kay-exports.d.ts.map +1 -1
  258. package/types/compiler/link-flags.d.ts +0 -6
  259. package/types/compiler/link-flags.d.ts.map +1 -1
  260. package/types/compiler/lints.d.ts +21 -566
  261. package/types/compiler/lints.d.ts.map +1 -1
  262. package/types/compiler/markup.d.ts +1 -1
  263. package/types/compiler/markup.d.ts.map +1 -1
  264. package/types/compiler/module-signals.d.ts.map +1 -1
  265. package/types/compiler/names.d.ts.map +1 -1
  266. package/types/compiler/page-settings.d.ts +4 -0
  267. package/types/compiler/page-settings.d.ts.map +1 -1
  268. package/types/compiler/parser.d.ts.map +1 -1
  269. package/types/compiler/plan.d.ts.map +1 -1
  270. package/types/compiler/removed-lints.d.ts +3 -0
  271. package/types/compiler/removed-lints.d.ts.map +1 -0
  272. package/types/compiler/script-server.d.ts.map +1 -1
  273. package/types/compiler/signal-from-prop.d.ts +4 -0
  274. package/types/compiler/signal-from-prop.d.ts.map +1 -0
  275. package/types/compiler/template-reads.d.ts +1 -0
  276. package/types/compiler/template-reads.d.ts.map +1 -1
  277. package/types/compiler/validate.d.ts.map +1 -1
  278. package/types/config-loader.d.ts.map +1 -1
  279. package/types/config-resolve.d.ts.map +1 -1
  280. package/types/config-shape.d.ts +1 -1
  281. package/types/config-shape.d.ts.map +1 -1
  282. package/types/config.d.ts +5 -105
  283. package/types/config.d.ts.map +1 -1
  284. package/types/dev/preload.d.ts.map +1 -1
  285. package/types/lsp/server.d.ts.map +1 -1
  286. package/types/migrate/markup.d.ts.map +1 -1
  287. package/types/runtime/action-call.d.ts.map +1 -1
  288. package/types/runtime/action-encode.d.ts +1 -0
  289. package/types/runtime/action-encode.d.ts.map +1 -1
  290. package/types/runtime/action-error.d.ts +1 -2
  291. package/types/runtime/action-error.d.ts.map +1 -1
  292. package/types/runtime/action-run.d.ts.map +1 -1
  293. package/types/runtime/action-shared.d.ts +1 -27
  294. package/types/runtime/action-shared.d.ts.map +1 -1
  295. package/types/runtime/action-stream.d.ts.map +1 -1
  296. package/types/runtime/action.d.ts +1 -1
  297. package/types/runtime/action.d.ts.map +1 -1
  298. package/types/runtime/call-result.d.ts +0 -10
  299. package/types/runtime/call-result.d.ts.map +1 -1
  300. package/types/runtime/checks.d.ts +14 -11
  301. package/types/runtime/checks.d.ts.map +1 -1
  302. package/types/runtime/client.d.ts.map +1 -1
  303. package/types/runtime/core.d.ts +2 -20
  304. package/types/runtime/core.d.ts.map +1 -1
  305. package/types/runtime/dom.d.ts +1 -1
  306. package/types/runtime/dom.d.ts.map +1 -1
  307. package/types/runtime/html.d.ts +1 -1
  308. package/types/runtime/html.d.ts.map +1 -1
  309. package/types/runtime/i18n.client.d.ts +0 -1
  310. package/types/runtime/i18n.client.d.ts.map +1 -1
  311. package/types/runtime/i18n.d.ts +1 -1
  312. package/types/runtime/i18n.d.ts.map +1 -1
  313. package/types/runtime/i18n.server.d.ts +0 -1
  314. package/types/runtime/i18n.server.d.ts.map +1 -1
  315. package/types/runtime/image.d.ts.map +1 -1
  316. package/types/runtime/index.d.ts +3 -3
  317. package/types/runtime/index.d.ts.map +1 -1
  318. package/types/runtime/island.server.d.ts +2 -0
  319. package/types/runtime/island.server.d.ts.map +1 -1
  320. package/types/runtime/live-resource.server.d.ts.map +1 -1
  321. package/types/runtime/live-value.shared.d.ts +7 -15
  322. package/types/runtime/live-value.shared.d.ts.map +1 -1
  323. package/types/runtime/live.d.ts +0 -11
  324. package/types/runtime/live.d.ts.map +1 -1
  325. package/types/runtime/local-types.d.ts +0 -14
  326. package/types/runtime/local-types.d.ts.map +1 -1
  327. package/types/runtime/navigate-api.d.ts +0 -4
  328. package/types/runtime/navigate-api.d.ts.map +1 -1
  329. package/types/runtime/navigate.d.ts.map +1 -1
  330. package/types/runtime/navigation-state.d.ts +0 -4
  331. package/types/runtime/navigation-state.d.ts.map +1 -1
  332. package/types/runtime/navigation.d.ts +2 -0
  333. package/types/runtime/navigation.d.ts.map +1 -1
  334. package/types/runtime/page-swap.d.ts.map +1 -1
  335. package/types/runtime/persist.d.ts +1 -0
  336. package/types/runtime/persist.d.ts.map +1 -1
  337. package/types/runtime/persisted.d.ts +0 -15
  338. package/types/runtime/persisted.d.ts.map +1 -1
  339. package/types/runtime/presence.d.ts +0 -2
  340. package/types/runtime/presence.d.ts.map +1 -1
  341. package/types/runtime/query-param.d.ts.map +1 -1
  342. package/types/runtime/reactive.d.ts +2 -1
  343. package/types/runtime/reactive.d.ts.map +1 -1
  344. package/types/runtime/refuse.d.ts +0 -7
  345. package/types/runtime/refuse.d.ts.map +1 -1
  346. package/types/runtime/store-base.d.ts +1 -2
  347. package/types/runtime/store-base.d.ts.map +1 -1
  348. package/types/runtime/swap-flight.d.ts +1 -1
  349. package/types/runtime/swap-flight.d.ts.map +1 -1
  350. package/types/runtime/swap-kept.d.ts.map +1 -1
  351. package/types/runtime/swap-morph.d.ts.map +1 -1
  352. package/types/runtime/text-hash.d.ts +2 -0
  353. package/types/runtime/text-hash.d.ts.map +1 -0
  354. package/types/runtime/uid.server.d.ts.map +1 -1
  355. package/types/runtime/values.d.ts +6 -1
  356. package/types/runtime/values.d.ts.map +1 -1
  357. package/types/runtime/with-query.d.ts +2 -0
  358. package/types/runtime/with-query.d.ts.map +1 -1
  359. package/types/server/action-hooks.d.ts +4 -4
  360. package/types/server/action-hooks.d.ts.map +1 -1
  361. package/types/server/actions.d.ts.map +1 -1
  362. package/types/server/api-modules.d.ts +0 -1
  363. package/types/server/api-modules.d.ts.map +1 -1
  364. package/types/server/app-stages.d.ts +5 -13
  365. package/types/server/app-stages.d.ts.map +1 -1
  366. package/types/server/app.d.ts +3 -8
  367. package/types/server/app.d.ts.map +1 -1
  368. package/types/server/auth-mails.d.ts +0 -5
  369. package/types/server/auth-mails.d.ts.map +1 -1
  370. package/types/server/env-state.d.ts +1 -0
  371. package/types/server/env-state.d.ts.map +1 -1
  372. package/types/server/guard-requirement.d.ts +0 -1
  373. package/types/server/guard-requirement.d.ts.map +1 -1
  374. package/types/server/image.d.ts +0 -1
  375. package/types/server/image.d.ts.map +1 -1
  376. package/types/server/index.d.ts +0 -2
  377. package/types/server/index.d.ts.map +1 -1
  378. package/types/server/job-context.d.ts +1 -1
  379. package/types/server/job-context.d.ts.map +1 -1
  380. package/types/server/jobs.d.ts +0 -4
  381. package/types/server/jobs.d.ts.map +1 -1
  382. package/types/server/kept-exports.d.ts.map +1 -1
  383. package/types/server/kv.d.ts +4 -4
  384. package/types/server/kv.d.ts.map +1 -1
  385. package/types/server/library.d.ts +1 -3
  386. package/types/server/library.d.ts.map +1 -1
  387. package/types/server/mcp.d.ts +0 -1
  388. package/types/server/mcp.d.ts.map +1 -1
  389. package/types/server/metrics.d.ts +0 -5
  390. package/types/server/metrics.d.ts.map +1 -1
  391. package/types/server/page-settings.d.ts +3 -3
  392. package/types/server/page-settings.d.ts.map +1 -1
  393. package/types/server/prerender.d.ts.map +1 -1
  394. package/types/server/protection.d.ts +6 -6
  395. package/types/server/protection.d.ts.map +1 -1
  396. package/types/server/queue.d.ts +1 -3
  397. package/types/server/queue.d.ts.map +1 -1
  398. package/types/server/rate-limit.d.ts +0 -2
  399. package/types/server/rate-limit.d.ts.map +1 -1
  400. package/types/server/render-document.d.ts +1 -1
  401. package/types/server/render-document.d.ts.map +1 -1
  402. package/types/server/routes.d.ts +1 -1
  403. package/types/server/routes.d.ts.map +1 -1
  404. package/types/server/scope.d.ts.map +1 -1
  405. package/types/server/session.d.ts +1 -1
  406. package/types/server/session.d.ts.map +1 -1
  407. package/types/server/signals.d.ts.map +1 -1
  408. package/types/server/signed.d.ts +0 -2
  409. package/types/server/signed.d.ts.map +1 -1
  410. package/types/server/source.d.ts +1 -1
  411. package/types/server/source.d.ts.map +1 -1
  412. package/types/server/storage.d.ts +0 -4
  413. package/types/server/storage.d.ts.map +1 -1
  414. package/types/server/vitals.d.ts +0 -1
  415. package/types/server/vitals.d.ts.map +1 -1
  416. package/types/server/work-scope.d.ts +0 -2
  417. package/types/server/work-scope.d.ts.map +1 -1
  418. package/types/server/workflow.d.ts +1 -1
  419. package/types/server/workflow.d.ts.map +1 -1
  420. package/types/test/index.d.ts.map +1 -1
  421. package/types/test/site-actions.d.ts +1 -1
  422. package/types/test/site-actions.d.ts.map +1 -1
  423. package/types/test/site-keys.d.ts +1 -1
  424. package/types/test/site-keys.d.ts.map +1 -1
  425. package/types/test/site-socket.d.ts +1 -1
  426. package/types/test/site-socket.d.ts.map +1 -1
  427. package/types/test/site-types.d.ts +0 -8
  428. package/types/test/site-types.d.ts.map +1 -1
  429. package/llms/deprecated-lints-1-105-libraries.md +0 -32
  430. package/llms/deprecated-lints-1-105.md +0 -58
  431. package/src/check/action-readers.ts +0 -115
  432. package/src/check/action-type.ts +0 -44
  433. package/src/check/ai-language.ts +0 -56
  434. package/src/check/app-hooks.ts +0 -90
  435. package/src/check/auth-methods.ts +0 -85
  436. package/src/check/auth-rate-limits.ts +0 -99
  437. package/src/check/call-result.ts +0 -242
  438. package/src/check/client-keys.ts +0 -10
  439. package/src/check/cms-options.ts +0 -81
  440. package/src/check/config-groups.ts +0 -22
  441. package/src/check/config-switches.ts +0 -38
  442. package/src/check/context-import.ts +0 -51
  443. package/src/check/env-files.ts +0 -31
  444. package/src/check/format-duration.ts +0 -75
  445. package/src/check/guard-options.ts +0 -58
  446. package/src/check/handler-events.ts +0 -149
  447. package/src/check/hook-context.ts +0 -94
  448. package/src/check/hook-names.ts +0 -104
  449. package/src/check/i18n-keys.ts +0 -50
  450. package/src/check/images-keys.ts +0 -54
  451. package/src/check/job-shapes.ts +0 -273
  452. package/src/check/link-flag-tests.ts +0 -130
  453. package/src/check/live-api.ts +0 -137
  454. package/src/check/mail-api.ts +0 -67
  455. package/src/check/one-state-api.ts +0 -357
  456. package/src/check/pages-options.ts +0 -35
  457. package/src/check/rate-enforce.ts +0 -53
  458. package/src/check/refusal-calls.ts +0 -185
  459. package/src/check/retired-lints.ts +0 -49
  460. package/src/check/route-keys.ts +0 -166
  461. package/src/check/secret-keys.ts +0 -83
  462. package/src/check/socket-frames.ts +0 -102
  463. package/src/check/source-readers.ts +0 -257
  464. package/src/check/store-ms.ts +0 -72
  465. package/src/check/store-names.ts +0 -88
  466. package/src/check/test-helpers.ts +0 -98
  467. package/src/check/ttl-names.ts +0 -142
  468. package/src/compiler/deprecated-ai-labels.ts +0 -97
  469. package/src/compiler/deprecated-ai-links.ts +0 -63
  470. package/src/compiler/deprecated-allow.ts +0 -50
  471. package/src/compiler/deprecated-auth-lints.ts +0 -14
  472. package/src/compiler/deprecated-auth-signed.ts +0 -29
  473. package/src/compiler/deprecated-children.ts +0 -66
  474. package/src/compiler/deprecated-image.ts +0 -116
  475. package/src/compiler/deprecated-island.ts +0 -155
  476. package/src/compiler/deprecated-lints-1-105.ts +0 -41
  477. package/src/compiler/deprecated-page.ts +0 -125
  478. package/src/compiler/deprecated-parts.ts +0 -22
  479. package/src/compiler/deprecated-typed-lints.ts +0 -23
  480. package/src/compiler/deprecated-ui-callbacks.ts +0 -66
  481. package/src/compiler/deprecated-ui-input.ts +0 -97
  482. package/src/compiler/deprecated-ui-items.ts +0 -47
  483. package/src/compiler/old-parts.ts +0 -84
  484. package/src/runtime/mount.compat.ts +0 -8
  485. package/src/server/moved-exports.ts +0 -17
  486. package/types/check/action-readers.d.ts +0 -3
  487. package/types/check/action-readers.d.ts.map +0 -1
  488. package/types/check/action-type.d.ts +0 -3
  489. package/types/check/action-type.d.ts.map +0 -1
  490. package/types/check/ai-language.d.ts +0 -3
  491. package/types/check/ai-language.d.ts.map +0 -1
  492. package/types/check/app-hooks.d.ts +0 -3
  493. package/types/check/app-hooks.d.ts.map +0 -1
  494. package/types/check/auth-methods.d.ts +0 -3
  495. package/types/check/auth-methods.d.ts.map +0 -1
  496. package/types/check/auth-rate-limits.d.ts +0 -3
  497. package/types/check/auth-rate-limits.d.ts.map +0 -1
  498. package/types/check/call-result.d.ts +0 -7
  499. package/types/check/call-result.d.ts.map +0 -1
  500. package/types/check/client-keys.d.ts +0 -3
  501. package/types/check/client-keys.d.ts.map +0 -1
  502. package/types/check/cms-options.d.ts +0 -3
  503. package/types/check/cms-options.d.ts.map +0 -1
  504. package/types/check/config-groups.d.ts +0 -3
  505. package/types/check/config-groups.d.ts.map +0 -1
  506. package/types/check/config-switches.d.ts +0 -3
  507. package/types/check/config-switches.d.ts.map +0 -1
  508. package/types/check/context-import.d.ts +0 -3
  509. package/types/check/context-import.d.ts.map +0 -1
  510. package/types/check/env-files.d.ts +0 -3
  511. package/types/check/env-files.d.ts.map +0 -1
  512. package/types/check/format-duration.d.ts +0 -5
  513. package/types/check/format-duration.d.ts.map +0 -1
  514. package/types/check/guard-options.d.ts +0 -3
  515. package/types/check/guard-options.d.ts.map +0 -1
  516. package/types/check/handler-events.d.ts +0 -9
  517. package/types/check/handler-events.d.ts.map +0 -1
  518. package/types/check/hook-context.d.ts +0 -3
  519. package/types/check/hook-context.d.ts.map +0 -1
  520. package/types/check/hook-names.d.ts +0 -3
  521. package/types/check/hook-names.d.ts.map +0 -1
  522. package/types/check/i18n-keys.d.ts +0 -3
  523. package/types/check/i18n-keys.d.ts.map +0 -1
  524. package/types/check/images-keys.d.ts +0 -3
  525. package/types/check/images-keys.d.ts.map +0 -1
  526. package/types/check/job-shapes.d.ts +0 -6
  527. package/types/check/job-shapes.d.ts.map +0 -1
  528. package/types/check/link-flag-tests.d.ts +0 -4
  529. package/types/check/link-flag-tests.d.ts.map +0 -1
  530. package/types/check/live-api.d.ts +0 -3
  531. package/types/check/live-api.d.ts.map +0 -1
  532. package/types/check/mail-api.d.ts +0 -3
  533. package/types/check/mail-api.d.ts.map +0 -1
  534. package/types/check/one-state-api.d.ts +0 -9
  535. package/types/check/one-state-api.d.ts.map +0 -1
  536. package/types/check/pages-options.d.ts +0 -3
  537. package/types/check/pages-options.d.ts.map +0 -1
  538. package/types/check/rate-enforce.d.ts +0 -3
  539. package/types/check/rate-enforce.d.ts.map +0 -1
  540. package/types/check/refusal-calls.d.ts +0 -3
  541. package/types/check/refusal-calls.d.ts.map +0 -1
  542. package/types/check/retired-lints.d.ts +0 -3
  543. package/types/check/retired-lints.d.ts.map +0 -1
  544. package/types/check/route-keys.d.ts +0 -3
  545. package/types/check/route-keys.d.ts.map +0 -1
  546. package/types/check/secret-keys.d.ts +0 -3
  547. package/types/check/secret-keys.d.ts.map +0 -1
  548. package/types/check/socket-frames.d.ts +0 -3
  549. package/types/check/socket-frames.d.ts.map +0 -1
  550. package/types/check/source-readers.d.ts +0 -3
  551. package/types/check/source-readers.d.ts.map +0 -1
  552. package/types/check/store-ms.d.ts +0 -3
  553. package/types/check/store-ms.d.ts.map +0 -1
  554. package/types/check/store-names.d.ts +0 -3
  555. package/types/check/store-names.d.ts.map +0 -1
  556. package/types/check/test-helpers.d.ts +0 -3
  557. package/types/check/test-helpers.d.ts.map +0 -1
  558. package/types/check/ttl-names.d.ts +0 -3
  559. package/types/check/ttl-names.d.ts.map +0 -1
  560. package/types/compiler/deprecated-ai-labels.d.ts +0 -5
  561. package/types/compiler/deprecated-ai-labels.d.ts.map +0 -1
  562. package/types/compiler/deprecated-ai-links.d.ts +0 -5
  563. package/types/compiler/deprecated-ai-links.d.ts.map +0 -1
  564. package/types/compiler/deprecated-allow.d.ts +0 -5
  565. package/types/compiler/deprecated-allow.d.ts.map +0 -1
  566. package/types/compiler/deprecated-auth-lints.d.ts +0 -12
  567. package/types/compiler/deprecated-auth-lints.d.ts.map +0 -1
  568. package/types/compiler/deprecated-auth-signed.d.ts +0 -5
  569. package/types/compiler/deprecated-auth-signed.d.ts.map +0 -1
  570. package/types/compiler/deprecated-children.d.ts +0 -4
  571. package/types/compiler/deprecated-children.d.ts.map +0 -1
  572. package/types/compiler/deprecated-image.d.ts +0 -5
  573. package/types/compiler/deprecated-image.d.ts.map +0 -1
  574. package/types/compiler/deprecated-island.d.ts +0 -9
  575. package/types/compiler/deprecated-island.d.ts.map +0 -1
  576. package/types/compiler/deprecated-lints-1-105.d.ts +0 -39
  577. package/types/compiler/deprecated-lints-1-105.d.ts.map +0 -1
  578. package/types/compiler/deprecated-page.d.ts +0 -4
  579. package/types/compiler/deprecated-page.d.ts.map +0 -1
  580. package/types/compiler/deprecated-parts.d.ts +0 -3
  581. package/types/compiler/deprecated-parts.d.ts.map +0 -1
  582. package/types/compiler/deprecated-typed-lints.d.ts +0 -21
  583. package/types/compiler/deprecated-typed-lints.d.ts.map +0 -1
  584. package/types/compiler/deprecated-ui-callbacks.d.ts +0 -5
  585. package/types/compiler/deprecated-ui-callbacks.d.ts.map +0 -1
  586. package/types/compiler/deprecated-ui-input.d.ts +0 -5
  587. package/types/compiler/deprecated-ui-input.d.ts.map +0 -1
  588. package/types/compiler/deprecated-ui-items.d.ts +0 -5
  589. package/types/compiler/deprecated-ui-items.d.ts.map +0 -1
  590. package/types/compiler/old-parts.d.ts +0 -9
  591. package/types/compiler/old-parts.d.ts.map +0 -1
  592. package/types/runtime/mount.compat.d.ts +0 -7
  593. package/types/runtime/mount.compat.d.ts.map +0 -1
  594. package/types/server/moved-exports.d.ts +0 -12
  595. package/types/server/moved-exports.d.ts.map +0 -1
@@ -1,16 +1,16 @@
1
1
  import type { Collection } from '../content'
2
- import type { PageSettings } from '../runtime'
2
+ import type { PageSeo, PageSettings } from '../runtime'
3
3
  import { KayError } from '../compiler/errors'
4
4
  import { SEO_SETTINGS } from '../compiler/page-settings'
5
5
  import { isRouteOf } from '../content/claims'
6
6
  import { registeredCollections } from '../content/edit-registry'
7
7
  import { durationSeconds } from '../runtime/duration'
8
8
 
9
- // A setting of a page module: its key of `export const page`, those of `seo` read from there first.
10
- export function pageSetting(module: object, name: keyof PageSettings): unknown {
9
+ // A setting of a page module: its key of `export const page`, those of `seo` read from there.
10
+ export function pageSetting(module: object, name: keyof PageSettings | keyof PageSeo): unknown {
11
11
  const page = (module as { page?: PageSettings }).page
12
12
 
13
- return SEO_SETTINGS.includes(name) ? ((page?.seo as Record<string, unknown> | undefined)?.[name] ?? page?.[name]) : page?.[name]
13
+ return SEO_SETTINGS.includes(name) ? (page?.seo as Record<string, unknown> | undefined)?.[name] : page?.[name as keyof PageSettings]
14
14
  }
15
15
 
16
16
  // A text of a page's `seo` group, as it is written.
@@ -61,7 +61,7 @@ function cacheOf(file: string, cache: NonNullable<PageSettings['cache']>): { ttl
61
61
  }
62
62
 
63
63
  // A setting along a route's modules, layouts outermost first and the page last: the innermost that sets it wins, so a page may undo what its layouts say.
64
- export function chainSetting(modules: object[], name: keyof PageSettings): unknown {
64
+ export function chainSetting(modules: object[], name: keyof PageSettings | keyof PageSeo): unknown {
65
65
  for (let index = modules.length - 1; index >= 0; index--) {
66
66
  const value = pageSetting(modules[index]!, name)
67
67
 
@@ -72,25 +72,16 @@ export function chainSetting(modules: object[], name: keyof PageSettings): unkno
72
72
  return undefined
73
73
  }
74
74
 
75
- // A page's lifetime and `cache-control` along its route: the `cache` of the innermost module that sets one, else its `ttl` and `cacheControl` as they were written before 1.105, each the innermost that sets it.
75
+ // A page's lifetime and `cache-control` along its route: the `cache` of the innermost module that sets one.
76
76
  export function chainCache(file: string, modules: object[]): { ttl: unknown, cacheControl: unknown } {
77
- let ttl: unknown
78
- let cacheControl: unknown
79
-
80
77
  for (let index = modules.length - 1; index >= 0; index--) {
81
- const page = (modules[index] as { page?: PageSettings }).page
82
-
83
- if (page?.cache !== undefined) {
84
- const given = cacheOf(file, page.cache)
85
-
86
- return { ttl: ttl ?? given.ttl, cacheControl: cacheControl ?? given.cacheControl }
87
- }
78
+ const cache = (modules[index] as { page?: PageSettings }).page?.cache
88
79
 
89
- ttl ??= page?.ttl
90
- cacheControl ??= page?.cacheControl
80
+ if (cache !== undefined)
81
+ return cacheOf(file, cache)
91
82
  }
92
83
 
93
- return { ttl, cacheControl }
84
+ return { ttl: undefined, cacheControl: undefined }
94
85
  }
95
86
 
96
87
  interface PageRoute {
@@ -46,6 +46,23 @@ import { setupPages } from './setup'
46
46
  import { STAMP_HOLE } from './stamp'
47
47
 
48
48
  const PARTS = new Intl.ListFormat('en-GB')
49
+ // An island the render marked as reading the query, whose markup is the default query's.
50
+ const QUERY_ISLAND = /<slot data-component="[^"]*" data-props=(?:"[^"]*"|'[^']*')[^>]*? data-query[ >]/g
51
+
52
+ // What the page reads with `live: true` in its own render, which the build runs once.
53
+ function warnUnfollowed(path: string, keys: string[] | undefined): void {
54
+ if (keys !== undefined)
55
+ kayLog('warn', `${path} reads ${keys.slice(0, 5).map(key => `'${key}'`).join(', ')}${keys.length > 5 ? ' and more' : ''} with \`live: true\` in its own render, which the build runs once: what the page shows of it itself goes stale and only its server islands follow, so drop \`prerender\` from \`export const page\` if the page shows it`)
56
+ }
57
+
58
+ // A page kept on its own reads no query, so only one asked for can hold such an island.
59
+ function warnQueryIslands(path: string, html: string, auto: boolean): void {
60
+ const count = auto ? 0 : [...html.matchAll(QUERY_ISLAND)].length
61
+
62
+ if (count > 0)
63
+ kayLog('warn', `${path} holds ${count === 1 ? 'an island' : `${count} islands`} reading a query param, drawn here at the default query: the browser draws ${count === 1 ? 'it' : 'them'} again when the page is opened with a query, so the markup before that, and with no JavaScript, is the default's`)
64
+ }
65
+
49
66
  const LINE_BREAK = /[\r\n]/
50
67
  const KAY_IMPORT = /\bfrom\s+['"]([^'"]+\.kay)['"]/g
51
68
  // The pages of a route rendering at once: a render waiting on a database, a CMS or a file lets the next ones run, while each page is still judged and written in turn, as one at a time would. Bounded, so the build holds no more pages than this.
@@ -390,8 +407,8 @@ export async function prerenderPages(project: Project, client: ClientBuild, opti
390
407
  if (islands.includes('defer') && client.entry === undefined)
391
408
  throw new KayError('export-server-render', `kay: it defers a server island, which kay's browser entry fetches, and with no island and \`navigation: false\` the build has none; mark it \`server\` to render it inline instead`)
392
409
 
393
- if (unfollowed !== undefined)
394
- kayLog('warn', `${copy.path} reads ${unfollowed.keys.slice(0, 5).map(key => `'${key}'`).join(', ')}${unfollowed.keys.length > 5 ? ' and more' : ''} with \`live: true\` in its own render, which the build runs once: what the page shows of it itself goes stale and only its server islands follow, so drop \`prerender\` from \`export const page\` if the page shows it`)
410
+ warnUnfollowed(copy.path, unfollowed?.keys)
411
+ warnQueryIslands(copy.path, html, auto)
395
412
 
396
413
  const name = `${copy.key === '/' ? 'index' : copy.key.slice(1)}.html`
397
414
  const taken = reserved.get(name) ?? paths.get(name)
@@ -239,7 +239,7 @@ export function sqliteRates(path: string): SyncRates {
239
239
  }
240
240
 
241
241
  // Answered at once, as a store reading SQLite needs no promise.
242
- export interface SyncRates { hit: (key: string, window: Duration | number, weight?: number) => RateWindow, peek: (key: string) => RateWindow | undefined, refund: (key: string, resetAt: number) => void, reset: (key: string) => void }
242
+ export interface SyncRates { hit: (key: string, window: Duration, weight?: number) => RateWindow, peek: (key: string) => RateWindow | undefined, refund: (key: string, resetAt: number) => void, reset: (key: string) => void }
243
243
  type OpenRates = SyncRates & { close: () => void }
244
244
 
245
245
  function openRates(path: string): OpenRates {
@@ -312,7 +312,7 @@ export interface Limiter {
312
312
  peek: (key: string) => Promise<RateWindow | undefined>
313
313
  // Forgets the window under `key`. A store with no `reset` has the count taken off with a hit of the negative weight, which leaves an empty window open.
314
314
  reset: (key: string) => Promise<void>
315
- // Counts an attempt under `key` and answers the seconds to wait once the count is past `max`, else undefined; it answers and refuses nothing. Not `rateLimit().enforce(ctx)`, which takes a guard's context and denies with 429.
315
+ // Counts an attempt under `key` and answers the seconds to wait once the count is past `max`, else undefined; it answers and refuses nothing. Not `rateLimit().check(ctx)`, which takes a guard's context and denies with 429.
316
316
  enforce: (key: string, weight?: number) => Promise<number | undefined>
317
317
  // Takes back one attempt `hit` counted in the window closing at `resetAt`; false when the store has no `refund`.
318
318
  refund: (key: string, resetAt: number) => Promise<boolean>
@@ -349,7 +349,7 @@ export function makeLimiter({ name, max, ms, store: given, failure, memory }: {
349
349
  return standIn.rates
350
350
  }
351
351
  const keyed = (key: string) => `${name}\n${key}`
352
- const hitIn = async (used: RateStore, key: string, weight?: number) => used.hit(keyed(key), lengthFor(used, ms), weight)
352
+ const hitIn = async (used: RateStore, key: string, weight?: number) => used.hit(keyed(key), lengthFor(ms), weight)
353
353
 
354
354
  const peek = async (key: string): Promise<RateWindow | undefined> => {
355
355
  const used = store()
@@ -357,7 +357,7 @@ export function makeLimiter({ name, max, ms, store: given, failure, memory }: {
357
357
  if (used.peek)
358
358
  return used.peek(keyed(key))
359
359
 
360
- const window = await used.hit(keyed(key), lengthFor(used, ms), 0)
360
+ const window = await used.hit(keyed(key), lengthFor(ms), 0)
361
361
 
362
362
  return window.count > 0 ? window : undefined
363
363
  }
@@ -381,10 +381,10 @@ export function makeLimiter({ name, max, ms, store: given, failure, memory }: {
381
381
  return
382
382
 
383
383
  // The window may have closed between the two calls, which a hit of minus the count would open at a negative count.
384
- const left = await used.hit(keyed(key), lengthFor(used, ms), -window.count)
384
+ const left = await used.hit(keyed(key), lengthFor(ms), -window.count)
385
385
 
386
386
  if (left.count < 0)
387
- await used.hit(keyed(key), lengthFor(used, ms), -left.count)
387
+ await used.hit(keyed(key), lengthFor(ms), -left.count)
388
388
  },
389
389
  enforce: async (key, weight) => waitFor(await hitIn(store(), key, weight), max),
390
390
  refund: async (key, resetAt) => {
@@ -715,7 +715,7 @@ export function ratesFor(name: string, given?: RateStore): RateStore {
715
715
 
716
716
  // What a store falls back on, answering at once.
717
717
  export interface FallbackMemory {
718
- hit: (key: string, windowMs: number, weight?: number) => RateWindow
718
+ hit: (key: string, window: Duration, weight?: number) => RateWindow
719
719
  peek: (key: string) => RateWindow | undefined
720
720
  refund?: ((key: string, resetAt: number) => void) | undefined
721
721
  reset?: ((key: string) => void) | undefined
@@ -730,7 +730,7 @@ export function ratesFallingBack<Store extends RateStore>(name: string, store: S
730
730
 
731
731
  // Each method is read off the store on each call, so one replaced on it later, as a test spies on it, is the one called.
732
732
  return {
733
- hit: async (key, window, weight) => answered(name, store, (...args: [string, Duration | number, number | undefined]): ReturnType<RateStore['hit']> => store.hit(...args), [key, lengthFor(store, lengthMs(window)), weight], () => memory.hit(key, lengthMs(window), weight)),
733
+ hit: async (key, window, weight) => answered(name, store, (...args: [string, Duration, number | undefined]): ReturnType<RateStore['hit']> => store.hit(...args), [key, lengthFor(lengthMs(window)), weight], () => memory.hit(key, lengthFor(lengthMs(window)), weight)),
734
734
  ...peek && { peek: async key => answered(name, store, store.peek ?? peek, [key], () => memory.peek(key)) },
735
735
  // Taken back in memory too, where the attempt was counted if the store failed then; memory only takes it off a window closing at that same `resetAt`.
736
736
  ...refund && { refund: async (key, resetAt) => {
@@ -854,15 +854,12 @@ export function rateKey(address: string): string {
854
854
  return `${groups.slice(0, 4).map(group => group.replace(LEADING_ZEROS, '')).join(':')}::/64`
855
855
  }
856
856
 
857
- // `true` is one proxy in front and a number that many, the short forms of `{ hops }`.
858
- function proxyOf(setting: ProxyConfig | number | boolean | undefined): ProxyConfig | undefined {
857
+ // `true` is one proxy in front, the short form of `{ hops: 1 }`.
858
+ function proxyOf(setting: ProxyConfig | boolean | undefined): ProxyConfig | undefined {
859
859
  if (setting === false)
860
860
  return undefined
861
861
 
862
- if (setting === true)
863
- return { hops: 1 }
864
-
865
- return typeof setting === 'number' ? { hops: setting } : setting
862
+ return setting === true ? { hops: 1 } : setting
866
863
  }
867
864
 
868
865
  // The server that received `request`, once the app read it.
@@ -871,7 +868,7 @@ export function requestServer(request: Request): Server<unknown> | undefined {
871
868
  }
872
869
 
873
870
  // Refuses a `proxy` setting that names no proxy, so the boot can before any build starts.
874
- export function checkProxy(setting: ProxyConfig | number | boolean | undefined): ProxyConfig | undefined {
871
+ export function checkProxy(setting: ProxyConfig | boolean | undefined): ProxyConfig | undefined {
875
872
  const proxy = proxyOf(setting)
876
873
 
877
874
  if (!proxy)
@@ -904,7 +901,7 @@ export function checkProxy(setting: ProxyConfig | number | boolean | undefined):
904
901
 
905
902
  // Records the app's proxy settings on each request it gets, for `clientAddress` to read them wherever it is called from.
906
903
  // In production a `proxy` left out is one proxy in front, read from private addresses only: a server there is behind one far more often than it faces visitors, and `false` says it is not.
907
- export function trustProxy(setting: ProxyConfig | number | boolean | undefined): ReceiveStep {
904
+ export function trustProxy(setting: ProxyConfig | boolean | undefined): ReceiveStep {
908
905
  const proxy = checkProxy(setting) ?? (setting === undefined && process.env.NODE_ENV === 'production' ? INFERRED_PROXY : undefined)
909
906
 
910
907
  return (request, server) => {
@@ -921,12 +918,12 @@ export function trustProxy(setting: ProxyConfig | number | boolean | undefined):
921
918
 
922
919
  // The socket's address, unless it is a proxy on this machine or network the app's `proxy` setting trusts: then the client's address as that proxy passed it on.
923
920
  // `proxy` stands in for the app's setting, for a plain Elysia app that `pages()` does not serve.
924
- export function clientAddress(request: Request, server: Server<unknown> | null | undefined, setting?: ProxyConfig | number | boolean): string {
921
+ export function clientAddress(request: Request, server: Server<unknown> | null | undefined, setting?: ProxyConfig | boolean): string {
925
922
  return knownAddress(request, server, setting) ?? 'unknown'
926
923
  }
927
924
 
928
925
  // `clientAddress`, or undefined for a request with no socket address and none a trusted proxy forwarded, which `clientAddress` counts as the one client `unknown`.
929
- export function knownAddress(request: Request, server: Server<unknown> | null | undefined, setting?: ProxyConfig | number | boolean): string | undefined {
926
+ export function knownAddress(request: Request, server: Server<unknown> | null | undefined, setting?: ProxyConfig | boolean): string | undefined {
930
927
  const proxy = proxyOf(setting)
931
928
  const record = recordOf(request)
932
929
  const address = rewrittenAddress(request) ?? (server ?? record?.server)?.requestIP(request)?.address
@@ -113,8 +113,6 @@ export interface QueueOptions<Payload> {
113
113
  concurrency?: number | undefined
114
114
  // How long a run may take: past it, the run counts as failed, its signal aborts and its worker is freed, and another process takes a job its dead process held as lost. 10 minutes by default, the name a schedule's limit has too.
115
115
  timeout?: Duration | undefined
116
- /** @deprecated `timeout`, the one name of a job's time limit. Removed in 1.108; `deprecated-job-options` rewrites it. */
117
- lostAfter?: Duration | undefined
118
116
  // `false` runs nothing: the queue starts no worker, so a job needing an optional service is switched by its setting, `enabled: url !== undefined`, as a schedule is. A job enqueued meanwhile waits in the store for a process that runs the queue.
119
117
  enabled?: boolean | undefined
120
118
  // The longest an idle queue waits between looks at the store, 10 seconds by default.
@@ -468,17 +466,16 @@ export function defaultJobStore(): JobStore {
468
466
  // A queue of jobs the server runs in the background, each surviving a restart: `enqueue` from an action, `app.use(queue)` in the server to run them.
469
467
  // A run that throws is retried later, waiting `backoff` then twice as long each time, until `attempts` runs failed: it is then kept as failed, logged and handed to `onError`.
470
468
  export function queue<Payload, Progress = unknown>(name: string, handler: (payload: Payload, ctx: JobContext<Progress>) => unknown, options: QueueOptions<Payload> = {}): Queue<Payload, Progress> {
471
- // The run's job is also the third argument, which a handler written `(payload, signal, job)` before 1.105 reads.
472
- return jobQueue<Payload, Progress>(name, (payload, ctx) => (handler as (payload: Payload, ctx: JobContext<Progress>, job: JobRef<Progress>) => unknown)(payload, ctx, ctx.job), options).queued
469
+ return jobQueue<Payload, Progress>(name, handler, options).queued
473
470
  }
474
471
 
475
472
  const REMOVED_OPTIONS = { onFailed: '`onError`, which also gets `id` and `attempts`', keepFailed: '`failedTtl`' }
476
473
 
477
474
  // `queue` for `workflow`: its handler also gets the hold of its run, and the admin it returns is what the workflow wakes its own queue and attaches its calls with.
478
- export function jobQueue<Payload, Progress = unknown>(name: string, handler: (payload: Payload, ctx: JobContext<Progress> & AbortSignal, run: RunHold) => unknown, options: QueueOptions<Payload> = {}, kind: 'queue' | 'workflow' = 'queue'): { queued: Queue<Payload, Progress>, admin: QueueAdmin } {
475
+ export function jobQueue<Payload, Progress = unknown>(name: string, handler: (payload: Payload, ctx: JobContext<Progress>, run: RunHold) => unknown, options: QueueOptions<Payload> = {}, kind: 'queue' | 'workflow' = 'queue'): { queued: Queue<Payload, Progress>, admin: QueueAdmin } {
479
476
  const attempts = options.attempts ?? DEFAULT_ATTEMPTS
480
477
  const backoff = durationSeconds(options.backoff ?? DEFAULT_BACKOFF, `queue('${name}')'s backoff`) * 1000
481
- const lostAfter = durationSeconds(options.timeout ?? options.lostAfter ?? DEFAULT_LOST_AFTER, `queue('${name}')'s timeout`) * 1000
478
+ const lostAfter = durationSeconds(options.timeout ?? DEFAULT_LOST_AFTER, `queue('${name}')'s timeout`) * 1000
482
479
  const concurrency = options.concurrency ?? 1
483
480
  const idlePoll = durationSeconds(options.idlePoll ?? DEFAULT_IDLE_POLL, `queue('${name}')'s idlePoll`) * 1000
484
481
  const keepFailed = options.failedTtl === false ? undefined : durationSeconds(options.failedTtl ?? DEFAULT_KEEP_FAILED, `queue('${name}')'s failedTtl`) * 1000
@@ -16,8 +16,6 @@ export interface RateLimiter extends RateLimit {
16
16
  count: (from: Request | string, server?: Server<unknown> | null, weight?: number) => Promise<RateWindow & { wait: number | undefined }>
17
17
  // For a guard: takes its `ctx`, counts the request under the limit's `key` or the client's address and, once over the limit, sets `Retry-After` and denies with 429, `message` (a text or a function of the seconds to wait) in place of kay's.
18
18
  check: (ctx: Pick<GuardContext, 'request' | 'headers' | 'deny' | 'locale' | 'cookies' | 'locals'>, message?: string | ((wait: number) => string)) => Promise<void>
19
- /** @deprecated `check(ctx, message?)`, as `limiter().enforce(key)` counts under a key and refuses nothing. Removed in 1.108; `deprecated-rate-enforce` rewrites it. */
20
- enforce: (ctx: Pick<GuardContext, 'request' | 'headers' | 'deny' | 'locale' | 'cookies' | 'locals'>, message?: string | ((wait: number) => string)) => Promise<void>
21
19
  }
22
20
 
23
21
  // A limit for a guard, an API route or a library, counted as an action's `rateLimit` is: `max` attempts from one client every `window`, under `name`, which limits sharing it count together.
@@ -53,7 +51,6 @@ export function rateLimit(name: string, limit: RateLimit): RateLimiter {
53
51
  ...limit,
54
52
  count,
55
53
  hit: async (from, server, weight) => (await count(from, server, weight)).wait,
56
- enforce: async (ctx, message) => limiter.check(ctx, message),
57
54
  check: async (ctx, message) => {
58
55
  const { request } = ctx
59
56
  const key = await actionKey(name, limiter, request, clientAddress(request, undefined), () => ({ request, locale: ctx.locale, cookies: ctx.cookies, locals: ctx.locals }))
@@ -21,7 +21,7 @@ import { collectHead, head as setHead } from '../runtime/head'
21
21
  import { child, component, html, newServerIslands, withinComponent, withServerIslands } from '../runtime/html'
22
22
  import { localePath, textDirection } from '../runtime/i18n'
23
23
  import { DEFAULT_MAX_DENSITY, RESOLVED_META } from '../runtime/image'
24
- import { unrevivableAction } from '../runtime/island.server'
24
+ import { inLayout, unrevivableAction } from '../runtime/island.server'
25
25
  import { resourcesUsed, resourcesWanted, withSeeds } from '../runtime/live-resource.server'
26
26
  import { localeState } from '../runtime/locale-state'
27
27
  import { kayLog } from '../runtime/log'
@@ -163,7 +163,7 @@ function outcomeScript(outcome: Outcome | null): string {
163
163
  text = encodeValue(outcome.succeeded ? outcome : { ...outcome, values: {} })
164
164
  }
165
165
  catch (error) {
166
- kayLog('warn', `what ${outcome.action} ${outcome.succeeded ? 'returned' : 'passed to ctx.fail'} cannot reach the page's islands: ${unsendable(error) ?? String(error)}`)
166
+ kayLog('warn', `what ${outcome.action} ${outcome.succeeded ? 'returned' : 'passed to ctx.deny'} cannot reach the page's islands: ${unsendable(error) ?? String(error)}`)
167
167
 
168
168
  return ''
169
169
  }
@@ -359,10 +359,12 @@ function registerSeo(module: PageModule): void {
359
359
 
360
360
  // The page inside its layouts, each through `component`, so what a layout provides reaches its page.
361
361
  // A layout's named slot is read off its page: reading one renders the page first, once, which hands the layout the blocks it wrote.
362
- export function viewOf(modules: PageModule[], data: Record<string, unknown>[], entry?: HeadTag[]): () => unknown {
362
+ export function viewOf(modules: PageModule[], data: Record<string, unknown>[], entry?: HeadTag[], files?: readonly string[]): () => unknown {
363
363
  const page = modules.length - 1
364
364
  const chain = newFillChain(modules.length)
365
365
  const declared = modules.map(module => module.slots)
366
+ // The layout a module renders as, for the islands it draws to carry it: none for the page.
367
+ const layoutOf = (index: number) => index < page && files?.[index] !== undefined ? projectPath(files[index]) : undefined
366
368
 
367
369
  // Set after its layouts' heads and before its own, which each replace what the entry gave.
368
370
  let view = () => {
@@ -373,7 +375,7 @@ export function viewOf(modules: PageModule[], data: Record<string, unknown>[], e
373
375
 
374
376
  registerSeo(modules[page]!)
375
377
 
376
- return component(modules[page]!.default, data[page]!)
378
+ return inLayout(undefined, () => component(modules[page]!.default, data[page]!))
377
379
  }
378
380
 
379
381
  for (let index = page - 1; index >= 0; index--) {
@@ -400,14 +402,14 @@ export function viewOf(modules: PageModule[], data: Record<string, unknown>[], e
400
402
 
401
403
  const found = filledBy(chain, declared, index, name)
402
404
 
403
- return found && withinComponent(modules[found.at]!.default, found.block)
405
+ return found && inLayout(layoutOf(found.at), () => withinComponent(modules[found.at]!.default, found.block))
404
406
  } })
405
407
  }
406
408
 
407
409
  chain.at = index
408
410
  registerSeo(modules[index]!)
409
411
 
410
- return component(modules[index]!.default, props)
412
+ return inLayout(layoutOf(index), () => component(modules[index]!.default, props))
411
413
  }
412
414
  }
413
415
 
@@ -451,7 +453,7 @@ function seedBlocks(deferred: PendingBlock[], seeds: ReadonlyMap<string, Seed>):
451
453
  }
452
454
 
453
455
  function documentOf(files: string[], modules: PageModule[], data: Record<string, unknown>[], client: ClientBuild, rendering: Rendering, options: RenderOptions, rules: QueryRules | undefined, entry?: HeadTag[]): string | Pieced | ReadableStream<Uint8Array> {
454
- const view = viewOf(modules, data, entry)
456
+ const view = viewOf(modules, data, entry, files)
455
457
  const chunks = islandChunks(client)
456
458
  // A prerendered page holds each server island between marks the server splits it at.
457
459
  const scan = options.prerendering ? Object.assign(newServerIslands(true), { awaits: options.awaits }) : undefined
@@ -664,7 +664,7 @@ export async function renderServerIslands(route: ServedRoute, context: RequestCo
664
664
  }
665
665
  }, () => rendering.headers.append('vary', 'cookie'), rules)
666
666
  const chunks = islandChunks(client)
667
- const { deferred, islands: shell } = inScope(() => withServerIslands(islands, () => renderStatic(viewOf(page.modules, page.data), undefined, chunks)))
667
+ const { deferred, islands: shell } = inScope(() => withServerIslands(islands, () => renderStatic(viewOf(page.modules, page.data, undefined, page.files), undefined, chunks)))
668
668
  const unrevivable = unrevivableAction(shell, client)
669
669
 
670
670
  if (unrevivable)
@@ -74,7 +74,7 @@ export interface Route {
74
74
  special: SpecialPages
75
75
  // `_guard.ts` files covering the page and its actions, outermost first.
76
76
  guards: GuardFile[]
77
- // No guard is asked of it on a site with `requireGuards`: it sets `guards: false`, or a library serves it.
77
+ // No guard is asked of it on a site with `guards.default` closed: it sets `guards: false`, or a library serves it.
78
78
  open?: true | undefined
79
79
  // The extension giving the editor serves it: one of its own screens, which renders no editor over it in edit mode.
80
80
  editorOwn?: true | undefined
@@ -240,12 +240,13 @@ export function servedPaths(routes: Route[]): Set<string> {
240
240
  return new Set(routes.flatMap(route => patternShapes(route.pattern)))
241
241
  }
242
242
 
243
- // Every file the reach walk meets while scanning the routes and the fallback pages, with what it reads of each, for `kay build` to record.
243
+ // Every file the reach walk meets while scanning the routes, the fallback pages and the endpoints, with what it reads of each, for `kay build` to record.
244
244
  export async function contextReadsOf(routesDir: string, mounts: RouteMount[]): Promise<ContextReads> {
245
245
  const reads: ContextReads = { keys: new Map(), edges: new Map(), recorded: false }
246
246
 
247
247
  await scanRoutes(routesDir, mounts, reads)
248
248
  await specialPagesOf(routeTrees(routesDir, mounts), '', reads)
249
+ await scanEndpoints(routesDir, mounts, reads)
249
250
 
250
251
  return reads
251
252
  }
@@ -299,7 +300,10 @@ export async function scanRoutes(routesDir: string, mounts: RouteMount[] = [], r
299
300
  }
300
301
 
301
302
  // The app's endpoint files, then each mounted library's that the app has none of at the same path.
302
- export async function scanEndpoints(routesDir: string, mounts: RouteMount[] = []): Promise<Endpoint[]> {
303
+ // Their guards place the special pages' layouts, so what the pages reach is open first, as a lookup of special pages opens it.
304
+ export async function scanEndpoints(routesDir: string, mounts: RouteMount[] = [], reads?: ContextReads): Promise<Endpoint[]> {
305
+ await openReaches(mounts, reads, false)
306
+
303
307
  const trees = routeTrees(routesDir, mounts)
304
308
  const endpoints: Endpoint[] = []
305
309
  const read: LayoutsRead = new Map()
@@ -4,6 +4,7 @@ import type { LoadScope, ServerScope } from '../runtime/reactive'
4
4
  import { AsyncLocalStorage } from 'node:async_hooks'
5
5
  import { setRequestOutcome } from '../runtime/action'
6
6
  import { setEndedEntryNote } from '../runtime/ended-entry'
7
+ import { noteQuery } from '../runtime/island.server'
7
8
  import { readParam } from '../runtime/query-param'
8
9
  import { setRequestCookieScope, setServerScope } from '../runtime/reactive'
9
10
  import { setCurrentUrl } from '../runtime/with-query'
@@ -51,7 +52,7 @@ export function inServerScope<T>(request: Request, report: (error: unknown) => v
51
52
 
52
53
  const url = requestUrl(request)
53
54
 
54
- return store.run({ request, values: new WeakMap(), cookie, param: name => readParam(rules, name, url.searchParams), report, path: url.pathname }, run)
55
+ return store.run({ request, values: new WeakMap(), cookie, param: name => readParam(rules, name, url.searchParams), read: noteQuery, report, path: url.pathname }, run)
55
56
  }
56
57
 
57
58
  // The request the render being run answers.
@@ -63,7 +64,7 @@ const outcomes = new AsyncLocalStorage<() => Outcome | null>()
63
64
 
64
65
  setRequestOutcome(() => outcomes.getStore()?.())
65
66
 
66
- // Answers a request whose form post, if any, `read` gives: an action's `form.failed()` and `succeeded()` read it in its loads and templates alike.
67
+ // Answers a request whose form post, if any, `read` gives: an action's `form.failed()` and `data()` read it in its loads and templates alike.
67
68
  export function withOutcome<T>(read: () => Outcome | null, run: () => T): T {
68
69
  return outcomes.run(read, run)
69
70
  }
@@ -41,9 +41,8 @@ export type DeletableSessionStore = SessionStore & { deleteWhere: (match: Sessio
41
41
  // Where sessions live when the cookie only carries their id; each method may answer synchronously or with a promise.
42
42
  export interface SessionStore extends StoreBase {
43
43
  get: (id: string) => MaybePromise<SessionData | undefined>
44
- // Past `maxAge` the store may forget the session: a `Duration` for a store with `durations: true`, milliseconds for one written before 1.105 (kept until 1.108); `lengthMs(maxAge)` from `kay` reads either.
45
- // eslint-disable-next-line ts/method-signature-style -- method syntax keeps a store written with `number` assignable (bivariance)
46
- set(id: string, data: SessionData, maxAge: Duration | number): MaybePromise<void>
44
+ // Past `maxAge` the store may forget the session: a `Duration`; `lengthMs(maxAge)` from `kay` reads it.
45
+ set: (id: string, data: SessionData, maxAge: Duration) => MaybePromise<void>
47
46
  delete: (id: string) => MaybePromise<void>
48
47
  // Deletes every session whose data `match` returns true for, such as a person's once they asked to be erased or their password changed, resolving with how many went.
49
48
  deleteWhere?: ((match: (data: SessionData) => boolean) => MaybePromise<number>) | undefined
@@ -422,7 +421,7 @@ class RequestSession<Data extends object> implements Session<Data> {
422
421
 
423
422
  if (store) {
424
423
  this.id ??= nodeCrypto().randomBytes(32).toString('base64url')
425
- await store.set(this.id, this.data, lengthFor(store, maxAge * 1000))
424
+ await store.set(this.id, this.data, lengthFor(maxAge * 1000))
426
425
  sealed = { id: this.id, issued: now, started, ...this.own }
427
426
  }
428
427
 
@@ -526,8 +525,8 @@ function opened(value: string, keys: Buffer[], name: string): { sealed: Sealed,
526
525
  }
527
526
  }
528
527
 
529
- // The `maxAge` a store is given, a `Duration` or milliseconds: one that is neither would store a session that never expires, or none.
530
- function storeMs(maxAge: Duration | number): number {
528
+ // The `maxAge` a store is given, a `Duration`: one that is not would store a session that never expires, or none.
529
+ function storeMs(maxAge: Duration): number {
531
530
  return lengthMs(maxAge, 'a session store\'s maxAge')
532
531
  }
533
532
 
@@ -126,7 +126,7 @@ async function setupWith<Claimed>(project: Project, loadClient: () => Promise<Cl
126
126
 
127
127
  await source.prepare(root, config.librarySettings, mode.prebuilt ? paths.output : undefined)
128
128
  // Scanned beside the routes, which the refusals before the build need.
129
- const scanning = Promise.all([publicFiles(paths.public), source.endpoints(paths.routes, mounts)])
129
+ const scanning = Promise.all([publicFiles(paths.public), source.endpoints(project, mounts)])
130
130
 
131
131
  void Promise.allSettled([scanning])
132
132
 
@@ -71,6 +71,12 @@ export class Denied {
71
71
  }
72
72
  }
73
73
 
74
+ // The text form `deny(403, 'text')` went in 1.109: a string where the options go is a mistake to name, not a refusal with no message.
75
+ function refuseText(options: unknown): void {
76
+ if (typeof options === 'string')
77
+ throw new KayError('argument-invalid', 'kay: ctx.deny takes a status and `{ message, errors, data }`: write `ctx.deny(403, { message: \'text\' })`')
78
+ }
79
+
74
80
  // What `ctx.redirect`, `ctx.notFound` and `ctx.deny` do in every kind of context: a read is redirected with 302, a post with 303.
75
81
  export function stoppers(request: Request): Pick<RequestContext, 'redirect' | 'notFound' | 'deny'> {
76
82
  const status = request.method === 'GET' || request.method === 'HEAD' ? 302 : 303
@@ -82,24 +88,28 @@ export function stoppers(request: Request): Pick<RequestContext, 'redirect' | 'n
82
88
  notFound: () => {
83
89
  throw new NotFound()
84
90
  },
85
- deny: (code = 403, second?: string | DenyOptions<ErrorData>, data?: ErrorData) => {
86
- throw typeof second === 'string' ? new Denied(code, second, data) : new Denied(code, second?.message, second?.data, second?.errors as Record<string, string> | undefined)
91
+ deny: (code?: number, options?: DenyOptions<ErrorData>) => {
92
+ refuseText(options)
93
+
94
+ throw new Denied(code ?? 403, options?.message, options?.data, options?.errors as Record<string, string> | undefined)
87
95
  },
88
96
  }
89
97
  }
90
98
 
91
- // `ctx.deny(status, { message, errors, data })` in an action fails the post as `ctx.fail` does, a form re-rendered with the message, the fields and `data`, a call throwing an `ActionError`. A deny with no options, or the old text form, stops as a guard's does.
99
+ // `ctx.deny(status, { message, errors, data })` in an action fails the post, a form re-rendered with the message, the fields and `data`, a call throwing an `ActionError`. A deny with no options stops as a guard's does.
92
100
  export function actionStoppers(request: Request): Pick<RequestContext, 'redirect' | 'notFound' | 'deny'> {
93
101
  const { deny: stop, ...rest } = stoppers(request)
94
102
 
95
- const deny = (status = 403, second?: string | DenyOptions<ErrorData>, data?: ErrorData): never => {
96
- if (typeof second === 'string' || !Number.isInteger(status) || status < 400 || status > 599)
97
- return stop(status, second as string, data)
103
+ const deny = (status = 403, second?: DenyOptions<ErrorData>): never => {
104
+ refuseText(second)
98
105
 
99
106
  if (second === undefined || ((second.message === undefined || second.message === '') && second.data === undefined && Object.keys(second.errors ?? {}).length === 0))
100
107
  return stop(status)
101
108
 
102
- // A text `data` with no `message` is the form's message, as `ctx.fail` made it; one with only data or fields has no form message, as `ctx.fail` had none.
109
+ if (!Number.isInteger(status) || status < 400 || status > 599)
110
+ throw new KayError('argument-invalid', `kay: ctx.deny takes an error status, from 400 to 599, not ${status}`)
111
+
112
+ // A text `data` with no `message` is the form's message; one with only data or fields has none.
103
113
  throw new RefusedError({ status, message: second.message ?? (typeof second.data === 'string' ? second.data : ''), errors: (second.errors ?? {}) as Record<string, string>, data: second.data })
104
114
  }
105
115
 
@@ -6,8 +6,6 @@ import { signedText, signText, useScriptSecret } from './stamp'
6
6
  export interface SignOptions {
7
7
  // How long the signature stays valid: `'1h'` when left out.
8
8
  ttl?: Duration | undefined
9
- /** @deprecated Written `ttl`; `deprecated-ttl-names` rewrites it. Removed in 1.108. */
10
- maxAge?: Duration | undefined
11
9
  }
12
10
 
13
11
  const DEFAULT_TTL = '1h'
@@ -36,7 +34,7 @@ export const signed = {
36
34
  sign(use: string, value: string, options: SignOptions = {}): string {
37
35
  checked(use, value)
38
36
 
39
- const seconds = durationSeconds(options.ttl ?? options.maxAge ?? DEFAULT_TTL, 'signed.sign()\'s ttl')
37
+ const seconds = durationSeconds(options.ttl ?? DEFAULT_TTL, 'signed.sign()\'s ttl')
40
38
 
41
39
  if (seconds > MAX_SECONDS)
42
40
  throw new KayError('argument-invalid', 'kay: signed.sign()\'s ttl is at most 1 year (\'52w\')')
@@ -3,6 +3,7 @@ import type { Mode, Project } from '../project'
3
3
  import type { ApiModule } from './api-modules'
4
4
  import type { Bundle } from './bundle'
5
5
  import type { ClientBuild } from './client'
6
+ import type { ContextReads } from './context-record'
6
7
  import type { Endpoint, Route, RouteMount, SpecialPages } from './routes'
7
8
  import type { ToolOutputs } from './tool-outputs'
8
9
  import { existsSync } from 'node:fs'
@@ -38,7 +39,7 @@ export interface ProjectSource {
38
39
  routes: (project: Pick<Project, 'root' | 'mode' | 'paths'>, mounts: RouteMount[]) => Promise<Route[]>
39
40
  fallback: (project: Pick<Project, 'root' | 'mode' | 'paths'>, mounts: RouteMount[]) => Promise<SpecialPages>
40
41
  api: (root: string, config: Pick<KayConfig, 'dirs' | 'extensions' | 'endpoints'>) => Promise<ApiModule[]>
41
- endpoints: (routesDir: string, mounts: RouteMount[]) => Promise<Endpoint[]>
42
+ endpoints: (project: Pick<Project, 'root' | 'mode' | 'paths'>, mounts: RouteMount[]) => Promise<Endpoint[]>
42
43
  // The file names under `src/plugins`: an executable holds the ones it was built with.
43
44
  plugins: (root: string) => string[]
44
45
  // The paths under `src/jobs`, held as `plugins` is.
@@ -56,6 +57,21 @@ export interface ProjectSource {
56
57
  toolOutputs: (root: string, output: string) => ToolOutputs
57
58
  }
58
59
 
60
+ // Read once per project, as the routes, the fallback pages and the endpoints each scan from it.
61
+ const records = new WeakMap<Project['paths'], Promise<ContextReads | undefined>>()
62
+
63
+ async function recordOf({ root, mode, paths }: Pick<Project, 'root' | 'mode' | 'paths'>): Promise<ContextReads | undefined> {
64
+ if (!mode.prebuilt)
65
+ return undefined
66
+
67
+ let held = records.get(paths)
68
+
69
+ if (held === undefined)
70
+ records.set(paths, held = readContextRecord(paths.output, root))
71
+
72
+ return held
73
+ }
74
+
59
75
  const DISK: ProjectSource = {
60
76
  embedded: false,
61
77
  mode: options => modeOf(options),
@@ -94,11 +110,11 @@ const DISK: ProjectSource = {
94
110
  await (await import('./loader')).registerLoader(root, settings)
95
111
  },
96
112
  has: file => existsSync(file),
97
- routes: async ({ root, mode, paths }, mounts) => scanRoutes(paths.routes, mounts, mode.prebuilt ? await readContextRecord(paths.output, root) : undefined),
98
- fallback: async ({ root, mode, paths }, mounts) => specialPagesOf(routeTrees(paths.routes, mounts), '', mode.prebuilt ? await readContextRecord(paths.output, root) : undefined),
113
+ routes: async (project, mounts) => scanRoutes(project.paths.routes, mounts, await recordOf(project)),
114
+ fallback: async (project, mounts) => specialPagesOf(routeTrees(project.paths.routes, mounts), '', await recordOf(project)),
99
115
  // Imported as it is asked for, as the API modules' actions read the locales, which read this.
100
116
  api: async (root, config) => (await import('./api-modules')).projectApi(root, config),
101
- endpoints: async (routesDir, mounts) => scanEndpoints(routesDir, mounts),
117
+ endpoints: async (project, mounts) => scanEndpoints(project.paths.routes, mounts, await recordOf(project)),
102
118
  plugins: root => pluginFiles(root),
103
119
  jobs: root => jobFiles(root),
104
120
  extensionCatalogs: (_, files) => files.filter(file => existsSync(file)),
@@ -51,7 +51,7 @@ export function prefetchMeta(prefetch: Prefetch = 'moderate'): string {
51
51
 
52
52
  // Never kay's own routes or the API, as the page swap leaves them too, nor a download or a link search engines are told not to follow, as a sign-out link often is.
53
53
  function rules(eagerness: Exclude<Prefetch, false>, nearest: boolean, base = '', apiPath = '/api'): string {
54
- const where = { and: [{ href_matches: `${base}/*` }, { not: { href_matches: `${base}/_kay/*` } }, { not: { href_matches: `${base}${apiPath}/*` } }, { not: { href_matches: `${base}${apiPath}` } }, { not: { selector_matches: `[data-no-prefetch], ${nearest ? `${OPTED_OUT}, ` : ''}[download], [rel~=nofollow]` } }] }
54
+ const where = { and: [{ href_matches: `${base}/*` }, { not: { href_matches: `${base}/_kay/*` } }, { not: { href_matches: `${base}${apiPath}/*` } }, { not: { href_matches: `${base}${apiPath}` } }, { not: { selector_matches: `${nearest ? `${OPTED_OUT}, ` : ''}[download], [rel~=nofollow]` } }] }
55
55
 
56
56
  return `<script type="speculationrules">${JSON.stringify({ prefetch: [{ source: 'document', where, eagerness }] })}</script>`
57
57
  }
@@ -68,8 +68,6 @@ export interface PutOptions {
68
68
  export interface UrlOptions {
69
69
  // How long a link to a private file stays valid, an hour by default; it is rounded up so pages rendered minutes apart give the same link, which the browser keeps cached.
70
70
  ttl?: Duration | undefined
71
- /** @deprecated Written `ttl`; `deprecated-ttl-names` rewrites it. Removed in 1.108. */
72
- maxAge?: Duration | undefined
73
71
  }
74
72
 
75
73
  const DEFAULT_DIR = 'data/files'
@@ -100,11 +98,8 @@ let current: { store: FileStore | undefined, cacheDir: string | undefined, varia
100
98
  let defaultStore: FileStore | undefined
101
99
 
102
100
  // Files in a directory of this machine, `data/files` by default, relative to where the server runs: `diskFiles({ dir, onWrite, onDelete })`, as `s3Files` and `memoryFiles` take their options.
103
- export function diskFiles(options?: FileHooks & { dir?: string | undefined }): FileStore
104
- /** @deprecated `diskFiles({ dir, ...hooks })`. Removed in 1.108; `deprecated-disk-files` rewrites it. */
105
- export function diskFiles(dir: string, hooks?: FileHooks): FileStore
106
- export function diskFiles(first: string | (FileHooks & { dir?: string | undefined }) = {}, second: FileHooks = {}): FileStore {
107
- const { dir = DEFAULT_DIR, ...hooks } = typeof first === 'string' ? { dir: first, ...second } : first
101
+ export function diskFiles(options: FileHooks & { dir?: string | undefined } = {}): FileStore {
102
+ const { dir = DEFAULT_DIR, ...hooks } = options
108
103
  const path = (key: string) => join(resolve(dir), key)
109
104
 
110
105
  return {
@@ -403,7 +398,7 @@ export const files = {
403
398
 
404
399
  readScriptSecret()
405
400
 
406
- const seconds = durationSeconds(options.ttl ?? options.maxAge ?? DEFAULT_EXPIRES, 'files.url()\'s ttl')
401
+ const seconds = durationSeconds(options.ttl ?? DEFAULT_EXPIRES, 'files.url()\'s ttl')
407
402
  const step = Math.min(EXPIRY_STEP, seconds)
408
403
  const until = Math.ceil((Date.now() / 1000 + seconds) / step) * step
409
404
 
@@ -162,7 +162,7 @@ function readText(schema: unknown, value: unknown, form: boolean, trim: boolean)
162
162
  const { properties, required = [] } = (isNode(schema) ? schema : {}) as { properties?: Record<string, Node>, required?: string[] }
163
163
 
164
164
  for (const [name, field] of Object.entries(properties ?? {})) {
165
- // A blank list is the empty one, as `persisted.query` writes it, never one blank item; a blank optional field with a default is left out, so the default fills in.
165
+ // A blank list is the empty one, as `queryParam` writes it, never one blank item; a blank optional field with a default is left out, so the default fills in.
166
166
  if (form && input[name] === '' && field.type === 'array')
167
167
  input[name] = []
168
168
  else if (form && input[name] === '' && field.default !== undefined && !required.includes(name))