@kayjs/kay 1.107.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 (576) hide show
  1. package/dist/eslint.js +1875 -3815
  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-libraries.md +1 -1
  12. package/llms/component-library-conventions.md +1 -1
  13. package/llms/components.md +4 -4
  14. package/llms/deprecated-lints.md +1 -7
  15. package/llms/effects.md +1 -1
  16. package/llms/errors.md +2 -2
  17. package/llms/events.md +1 -1
  18. package/llms/guards.md +1 -1
  19. package/llms/head.md +1 -1
  20. package/llms/hooks.md +2 -2
  21. package/llms/images.md +1 -1
  22. package/llms/island-and-form-lints.md +2 -1
  23. package/llms/island-sources.md +1 -1
  24. package/llms/islands-state-to-ids.md +2 -2
  25. package/llms/islands.md +5 -3
  26. package/llms/lints.md +1 -1
  27. package/llms/live-values.md +3 -3
  28. package/llms/local-collections.md +1 -1
  29. package/llms/locales.md +1 -1
  30. package/llms/mcp.md +2 -2
  31. package/llms/metrics.md +1 -1
  32. package/llms/navigation-from-code.md +6 -6
  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/testing-mount.md +49 -0
  46. package/llms/testing.md +4 -45
  47. package/llms/upgrading-1-105-config.md +13 -13
  48. package/llms/upgrading-archive.md +42 -82
  49. package/llms/upgrading.md +92 -58
  50. package/llms/whats-new-archive.md +36 -1
  51. package/llms/whats-new.md +18 -39
  52. package/llms.txt +6 -7
  53. package/package.json +6 -10
  54. package/src/build/client.ts +7 -6
  55. package/src/build/icon-slots.ts +140 -0
  56. package/src/build/libraries.ts +24 -2
  57. package/src/build/plugin.ts +10 -0
  58. package/src/build/route-sizes.ts +2 -3
  59. package/src/build/runtime-chunk.ts +2 -2
  60. package/src/build/source-files.ts +8 -3
  61. package/src/build/variants.ts +90 -1
  62. package/src/check/browser-global-reads.ts +2 -2
  63. package/src/check/config-objects.ts +1 -1
  64. package/src/check/diagnose.ts +0 -22
  65. package/src/check/export-homes.ts +1 -1
  66. package/src/check/guards.ts +3 -3
  67. package/src/check/index.ts +2 -7
  68. package/src/check/moved-keys.ts +1 -1
  69. package/src/check/project.ts +4 -9
  70. package/src/check/renamed-packages.ts +3 -63
  71. package/src/check/shadow-types.ts +4 -104
  72. package/src/commands/check.ts +2 -2
  73. package/src/commands/env.ts +25 -3
  74. package/src/compiler/ast.ts +18 -16
  75. package/src/compiler/browser.ts +2 -14
  76. package/src/compiler/class-items.ts +16 -0
  77. package/src/compiler/codegen.ts +8 -8
  78. package/src/compiler/dead-code.ts +22 -0
  79. package/src/compiler/deprecated-library.ts +0 -12
  80. package/src/compiler/deprecated-lints.ts +4 -505
  81. package/src/compiler/deprecated-ui-props.ts +5 -5
  82. package/src/compiler/dom-property.ts +23 -0
  83. package/src/compiler/dom.ts +15 -15
  84. package/src/compiler/errors.ts +2 -2
  85. package/src/compiler/fence-checks.ts +2 -121
  86. package/src/compiler/hand-parts.ts +55 -0
  87. package/src/compiler/helper-imports.ts +2 -2
  88. package/src/compiler/image-attributes.ts +1 -3
  89. package/src/compiler/index.ts +20 -21
  90. package/src/compiler/island-arguments.ts +8 -95
  91. package/src/compiler/island-cause.ts +7 -7
  92. package/src/compiler/island-declaration.ts +2 -8
  93. package/src/compiler/island-lints.ts +12 -0
  94. package/src/compiler/island-marker.ts +3 -3
  95. package/src/compiler/island-problems.ts +25 -0
  96. package/src/compiler/jsx-class.ts +1 -25
  97. package/src/compiler/jsx.ts +2 -2
  98. package/src/compiler/kay-exports.ts +0 -2
  99. package/src/compiler/link-flags.ts +9 -38
  100. package/src/compiler/lints.ts +7 -14
  101. package/src/compiler/markup.ts +23 -26
  102. package/src/compiler/module-signals.ts +2 -2
  103. package/src/compiler/names.ts +1 -1
  104. package/src/compiler/page-settings.ts +11 -0
  105. package/src/compiler/parser.ts +6 -8
  106. package/src/compiler/plan.ts +1 -3
  107. package/src/compiler/rewrite.ts +3 -18
  108. package/src/compiler/script-server.ts +8 -3
  109. package/src/compiler/validate.ts +3 -8
  110. package/src/config-loader.ts +14 -4
  111. package/src/config-resolve.ts +18 -142
  112. package/src/config-shape.ts +44 -34
  113. package/src/config.ts +10 -114
  114. package/src/dev/preload.ts +4 -1
  115. package/src/lsp/server.ts +4 -0
  116. package/src/migrate/markup.ts +4 -1
  117. package/src/package-names.ts +1 -1
  118. package/src/runtime/action-call.ts +39 -335
  119. package/src/runtime/action-encode.ts +26 -0
  120. package/src/runtime/action-error.ts +3 -11
  121. package/src/runtime/action-protection.ts +2 -2
  122. package/src/runtime/action-run.ts +332 -0
  123. package/src/runtime/action-shared.ts +14 -37
  124. package/src/runtime/action-stream.ts +0 -1
  125. package/src/runtime/action.ts +1 -1
  126. package/src/runtime/call-result.ts +2 -10
  127. package/src/runtime/checks.ts +11 -11
  128. package/src/runtime/client.ts +2 -2
  129. package/src/runtime/core.ts +5 -23
  130. package/src/runtime/dom.ts +1 -1
  131. package/src/runtime/html.ts +1 -1
  132. package/src/runtime/i18n.client.ts +1 -4
  133. package/src/runtime/i18n.server.ts +1 -4
  134. package/src/runtime/i18n.ts +3 -3
  135. package/src/runtime/index.ts +2 -2
  136. package/src/runtime/island.server.ts +18 -5
  137. package/src/runtime/live-resource.server.ts +0 -1
  138. package/src/runtime/live-value.server.ts +2 -2
  139. package/src/runtime/live-value.shared.ts +7 -20
  140. package/src/runtime/live.ts +1 -12
  141. package/src/runtime/local-types.ts +1 -11
  142. package/src/runtime/local.ts +4 -14
  143. package/src/runtime/navigate-api.ts +2 -5
  144. package/src/runtime/navigation-state.ts +0 -12
  145. package/src/runtime/page-swap.ts +6 -6
  146. package/src/runtime/persist.ts +11 -3
  147. package/src/runtime/persisted.ts +4 -30
  148. package/src/runtime/presence.ts +6 -7
  149. package/src/runtime/query-param.ts +20 -12
  150. package/src/runtime/reactive.ts +3 -1
  151. package/src/runtime/refuse.ts +3 -17
  152. package/src/runtime/store-base.ts +4 -6
  153. package/src/runtime/swap-fetch.ts +1 -1
  154. package/src/runtime/values.ts +40 -23
  155. package/src/runtime/with-query.ts +9 -0
  156. package/src/server/action-hooks.ts +8 -8
  157. package/src/server/actions.ts +13 -14
  158. package/src/server/api-modules.ts +2 -3
  159. package/src/server/app-stages.ts +15 -33
  160. package/src/server/app.ts +10 -5
  161. package/src/server/auth-mails.ts +0 -2
  162. package/src/server/env-state.ts +40 -10
  163. package/src/server/flash.ts +1 -1
  164. package/src/server/guard-requirement.ts +4 -4
  165. package/src/server/image.ts +2 -2
  166. package/src/server/index.ts +0 -2
  167. package/src/server/job-context.ts +3 -3
  168. package/src/server/jobs-page.ts +1 -1
  169. package/src/server/jobs.ts +5 -9
  170. package/src/server/kept-exports.ts +0 -2
  171. package/src/server/kv.ts +11 -14
  172. package/src/server/library.ts +1 -3
  173. package/src/server/live.ts +2 -2
  174. package/src/server/mcp.ts +3 -9
  175. package/src/server/metrics.ts +2 -4
  176. package/src/server/page-settings.ts +10 -19
  177. package/src/server/prerender.ts +19 -2
  178. package/src/server/protection.ts +15 -18
  179. package/src/server/queue.ts +3 -6
  180. package/src/server/rate-limit.ts +0 -3
  181. package/src/server/render-document.ts +1 -1
  182. package/src/server/routes.ts +7 -3
  183. package/src/server/scope.ts +3 -2
  184. package/src/server/session.ts +5 -6
  185. package/src/server/setup.ts +1 -1
  186. package/src/server/signals.ts +17 -7
  187. package/src/server/signed.ts +1 -3
  188. package/src/server/source.ts +20 -4
  189. package/src/server/speculation.ts +1 -1
  190. package/src/server/storage.ts +3 -8
  191. package/src/server/validate.ts +1 -1
  192. package/src/server/vitals.ts +1 -3
  193. package/src/server/work-scope.ts +2 -4
  194. package/src/server/work.ts +1 -1
  195. package/src/server/workflow.ts +1 -1
  196. package/src/test/index.ts +2 -1
  197. package/src/test/site-actions.ts +16 -6
  198. package/src/test/site-keys.ts +10 -15
  199. package/src/test/site-socket.ts +1 -2
  200. package/src/test/site-types.ts +0 -8
  201. package/types/build/client.d.ts +1 -1
  202. package/types/build/client.d.ts.map +1 -1
  203. package/types/build/icon-slots.d.ts +7 -0
  204. package/types/build/icon-slots.d.ts.map +1 -0
  205. package/types/build/libraries.d.ts +2 -0
  206. package/types/build/libraries.d.ts.map +1 -1
  207. package/types/build/plugin.d.ts +1 -0
  208. package/types/build/plugin.d.ts.map +1 -1
  209. package/types/build/route-sizes.d.ts.map +1 -1
  210. package/types/build/source-files.d.ts.map +1 -1
  211. package/types/build/variants.d.ts.map +1 -1
  212. package/types/check/diagnose.d.ts.map +1 -1
  213. package/types/check/index.d.ts +1 -2
  214. package/types/check/index.d.ts.map +1 -1
  215. package/types/check/project.d.ts.map +1 -1
  216. package/types/check/renamed-packages.d.ts +0 -3
  217. package/types/check/renamed-packages.d.ts.map +1 -1
  218. package/types/check/shadow-types.d.ts.map +1 -1
  219. package/types/commands/env.d.ts.map +1 -1
  220. package/types/compiler/ast.d.ts +1 -2
  221. package/types/compiler/ast.d.ts.map +1 -1
  222. package/types/compiler/browser.d.ts.map +1 -1
  223. package/types/compiler/class-items.d.ts +7 -0
  224. package/types/compiler/class-items.d.ts.map +1 -0
  225. package/types/compiler/dead-code.d.ts +9 -0
  226. package/types/compiler/dead-code.d.ts.map +1 -0
  227. package/types/compiler/deprecated-library.d.ts.map +1 -1
  228. package/types/compiler/deprecated-lints.d.ts +0 -560
  229. package/types/compiler/deprecated-lints.d.ts.map +1 -1
  230. package/types/compiler/deprecated-ui-props.d.ts +1 -8
  231. package/types/compiler/deprecated-ui-props.d.ts.map +1 -1
  232. package/types/compiler/dom-property.d.ts +9 -0
  233. package/types/compiler/dom-property.d.ts.map +1 -0
  234. package/types/compiler/dom.d.ts +1 -0
  235. package/types/compiler/dom.d.ts.map +1 -1
  236. package/types/compiler/errors.d.ts +2 -2
  237. package/types/compiler/errors.d.ts.map +1 -1
  238. package/types/compiler/fence-checks.d.ts +0 -1
  239. package/types/compiler/fence-checks.d.ts.map +1 -1
  240. package/types/compiler/hand-parts.d.ts +7 -0
  241. package/types/compiler/hand-parts.d.ts.map +1 -0
  242. package/types/compiler/image-attributes.d.ts +0 -1
  243. package/types/compiler/image-attributes.d.ts.map +1 -1
  244. package/types/compiler/index.d.ts.map +1 -1
  245. package/types/compiler/island-arguments.d.ts +2 -11
  246. package/types/compiler/island-arguments.d.ts.map +1 -1
  247. package/types/compiler/island-cause.d.ts +1 -1
  248. package/types/compiler/island-cause.d.ts.map +1 -1
  249. package/types/compiler/island-declaration.d.ts +1 -3
  250. package/types/compiler/island-declaration.d.ts.map +1 -1
  251. package/types/compiler/island-lints.d.ts +10 -0
  252. package/types/compiler/island-lints.d.ts.map +1 -0
  253. package/types/compiler/island-problems.d.ts +7 -0
  254. package/types/compiler/island-problems.d.ts.map +1 -0
  255. package/types/compiler/jsx-class.d.ts +1 -2
  256. package/types/compiler/jsx-class.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 +11 -572
  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/script-server.d.ts.map +1 -1
  271. package/types/compiler/validate.d.ts.map +1 -1
  272. package/types/config-loader.d.ts.map +1 -1
  273. package/types/config-resolve.d.ts.map +1 -1
  274. package/types/config-shape.d.ts +1 -1
  275. package/types/config-shape.d.ts.map +1 -1
  276. package/types/config.d.ts +5 -105
  277. package/types/config.d.ts.map +1 -1
  278. package/types/dev/preload.d.ts.map +1 -1
  279. package/types/lsp/server.d.ts.map +1 -1
  280. package/types/migrate/markup.d.ts.map +1 -1
  281. package/types/runtime/action-call.d.ts.map +1 -1
  282. package/types/runtime/action-encode.d.ts +1 -0
  283. package/types/runtime/action-encode.d.ts.map +1 -1
  284. package/types/runtime/action-error.d.ts +1 -2
  285. package/types/runtime/action-error.d.ts.map +1 -1
  286. package/types/runtime/action-run.d.ts +23 -0
  287. package/types/runtime/action-run.d.ts.map +1 -0
  288. package/types/runtime/action-shared.d.ts +1 -27
  289. package/types/runtime/action-shared.d.ts.map +1 -1
  290. package/types/runtime/action-stream.d.ts.map +1 -1
  291. package/types/runtime/action.d.ts +1 -1
  292. package/types/runtime/action.d.ts.map +1 -1
  293. package/types/runtime/call-result.d.ts +0 -10
  294. package/types/runtime/call-result.d.ts.map +1 -1
  295. package/types/runtime/checks.d.ts +6 -9
  296. package/types/runtime/checks.d.ts.map +1 -1
  297. package/types/runtime/core.d.ts +2 -20
  298. package/types/runtime/core.d.ts.map +1 -1
  299. package/types/runtime/dom.d.ts +1 -1
  300. package/types/runtime/dom.d.ts.map +1 -1
  301. package/types/runtime/html.d.ts +1 -1
  302. package/types/runtime/html.d.ts.map +1 -1
  303. package/types/runtime/i18n.client.d.ts +0 -1
  304. package/types/runtime/i18n.client.d.ts.map +1 -1
  305. package/types/runtime/i18n.d.ts +1 -1
  306. package/types/runtime/i18n.d.ts.map +1 -1
  307. package/types/runtime/i18n.server.d.ts +0 -1
  308. package/types/runtime/i18n.server.d.ts.map +1 -1
  309. package/types/runtime/index.d.ts +2 -2
  310. package/types/runtime/index.d.ts.map +1 -1
  311. package/types/runtime/island.server.d.ts +1 -0
  312. package/types/runtime/island.server.d.ts.map +1 -1
  313. package/types/runtime/live-resource.server.d.ts.map +1 -1
  314. package/types/runtime/live-value.shared.d.ts +7 -15
  315. package/types/runtime/live-value.shared.d.ts.map +1 -1
  316. package/types/runtime/live.d.ts +0 -11
  317. package/types/runtime/live.d.ts.map +1 -1
  318. package/types/runtime/local-types.d.ts +0 -14
  319. package/types/runtime/local-types.d.ts.map +1 -1
  320. package/types/runtime/navigate-api.d.ts +0 -4
  321. package/types/runtime/navigate-api.d.ts.map +1 -1
  322. package/types/runtime/navigation-state.d.ts +0 -4
  323. package/types/runtime/navigation-state.d.ts.map +1 -1
  324. package/types/runtime/page-swap.d.ts.map +1 -1
  325. package/types/runtime/persist.d.ts +1 -0
  326. package/types/runtime/persist.d.ts.map +1 -1
  327. package/types/runtime/persisted.d.ts +0 -15
  328. package/types/runtime/persisted.d.ts.map +1 -1
  329. package/types/runtime/presence.d.ts +0 -2
  330. package/types/runtime/presence.d.ts.map +1 -1
  331. package/types/runtime/query-param.d.ts.map +1 -1
  332. package/types/runtime/reactive.d.ts +2 -1
  333. package/types/runtime/reactive.d.ts.map +1 -1
  334. package/types/runtime/refuse.d.ts +0 -7
  335. package/types/runtime/refuse.d.ts.map +1 -1
  336. package/types/runtime/store-base.d.ts +1 -2
  337. package/types/runtime/store-base.d.ts.map +1 -1
  338. package/types/runtime/values.d.ts +2 -1
  339. package/types/runtime/values.d.ts.map +1 -1
  340. package/types/runtime/with-query.d.ts +2 -0
  341. package/types/runtime/with-query.d.ts.map +1 -1
  342. package/types/server/action-hooks.d.ts +4 -4
  343. package/types/server/action-hooks.d.ts.map +1 -1
  344. package/types/server/actions.d.ts.map +1 -1
  345. package/types/server/api-modules.d.ts +0 -1
  346. package/types/server/api-modules.d.ts.map +1 -1
  347. package/types/server/app-stages.d.ts +5 -13
  348. package/types/server/app-stages.d.ts.map +1 -1
  349. package/types/server/app.d.ts +3 -8
  350. package/types/server/app.d.ts.map +1 -1
  351. package/types/server/auth-mails.d.ts +0 -5
  352. package/types/server/auth-mails.d.ts.map +1 -1
  353. package/types/server/env-state.d.ts +1 -0
  354. package/types/server/env-state.d.ts.map +1 -1
  355. package/types/server/guard-requirement.d.ts +0 -1
  356. package/types/server/guard-requirement.d.ts.map +1 -1
  357. package/types/server/image.d.ts +0 -1
  358. package/types/server/image.d.ts.map +1 -1
  359. package/types/server/index.d.ts +0 -2
  360. package/types/server/index.d.ts.map +1 -1
  361. package/types/server/job-context.d.ts +1 -1
  362. package/types/server/job-context.d.ts.map +1 -1
  363. package/types/server/jobs.d.ts +0 -4
  364. package/types/server/jobs.d.ts.map +1 -1
  365. package/types/server/kept-exports.d.ts.map +1 -1
  366. package/types/server/kv.d.ts +4 -4
  367. package/types/server/kv.d.ts.map +1 -1
  368. package/types/server/library.d.ts +1 -3
  369. package/types/server/library.d.ts.map +1 -1
  370. package/types/server/mcp.d.ts +0 -1
  371. package/types/server/mcp.d.ts.map +1 -1
  372. package/types/server/metrics.d.ts +0 -5
  373. package/types/server/metrics.d.ts.map +1 -1
  374. package/types/server/page-settings.d.ts +3 -3
  375. package/types/server/page-settings.d.ts.map +1 -1
  376. package/types/server/prerender.d.ts.map +1 -1
  377. package/types/server/protection.d.ts +6 -6
  378. package/types/server/protection.d.ts.map +1 -1
  379. package/types/server/queue.d.ts +1 -3
  380. package/types/server/queue.d.ts.map +1 -1
  381. package/types/server/rate-limit.d.ts +0 -2
  382. package/types/server/rate-limit.d.ts.map +1 -1
  383. package/types/server/routes.d.ts +1 -1
  384. package/types/server/routes.d.ts.map +1 -1
  385. package/types/server/scope.d.ts.map +1 -1
  386. package/types/server/session.d.ts +1 -1
  387. package/types/server/session.d.ts.map +1 -1
  388. package/types/server/signals.d.ts.map +1 -1
  389. package/types/server/signed.d.ts +0 -2
  390. package/types/server/signed.d.ts.map +1 -1
  391. package/types/server/source.d.ts +1 -1
  392. package/types/server/source.d.ts.map +1 -1
  393. package/types/server/storage.d.ts +0 -4
  394. package/types/server/storage.d.ts.map +1 -1
  395. package/types/server/vitals.d.ts +0 -1
  396. package/types/server/vitals.d.ts.map +1 -1
  397. package/types/server/work-scope.d.ts +0 -2
  398. package/types/server/work-scope.d.ts.map +1 -1
  399. package/types/server/workflow.d.ts +1 -1
  400. package/types/server/workflow.d.ts.map +1 -1
  401. package/types/test/index.d.ts.map +1 -1
  402. package/types/test/site-actions.d.ts +1 -1
  403. package/types/test/site-actions.d.ts.map +1 -1
  404. package/types/test/site-keys.d.ts +1 -1
  405. package/types/test/site-keys.d.ts.map +1 -1
  406. package/types/test/site-socket.d.ts +1 -1
  407. package/types/test/site-socket.d.ts.map +1 -1
  408. package/types/test/site-types.d.ts +0 -8
  409. package/types/test/site-types.d.ts.map +1 -1
  410. package/llms/deprecated-lints-1-105-libraries.md +0 -32
  411. package/llms/deprecated-lints-1-105.md +0 -58
  412. package/src/check/action-readers.ts +0 -115
  413. package/src/check/action-type.ts +0 -44
  414. package/src/check/ai-language.ts +0 -56
  415. package/src/check/app-hooks.ts +0 -90
  416. package/src/check/auth-methods.ts +0 -85
  417. package/src/check/auth-rate-limits.ts +0 -99
  418. package/src/check/call-result.ts +0 -242
  419. package/src/check/client-keys.ts +0 -10
  420. package/src/check/cms-options.ts +0 -81
  421. package/src/check/config-groups.ts +0 -22
  422. package/src/check/config-switches.ts +0 -38
  423. package/src/check/context-import.ts +0 -51
  424. package/src/check/env-files.ts +0 -31
  425. package/src/check/format-duration.ts +0 -75
  426. package/src/check/guard-options.ts +0 -58
  427. package/src/check/handler-events.ts +0 -149
  428. package/src/check/hook-context.ts +0 -94
  429. package/src/check/hook-names.ts +0 -104
  430. package/src/check/i18n-keys.ts +0 -50
  431. package/src/check/images-keys.ts +0 -54
  432. package/src/check/job-shapes.ts +0 -273
  433. package/src/check/link-flag-tests.ts +0 -130
  434. package/src/check/live-api.ts +0 -137
  435. package/src/check/mail-api.ts +0 -67
  436. package/src/check/one-state-api.ts +0 -357
  437. package/src/check/pages-options.ts +0 -35
  438. package/src/check/rate-enforce.ts +0 -53
  439. package/src/check/refusal-calls.ts +0 -185
  440. package/src/check/retired-lints.ts +0 -49
  441. package/src/check/route-keys.ts +0 -166
  442. package/src/check/secret-keys.ts +0 -83
  443. package/src/check/socket-frames.ts +0 -102
  444. package/src/check/source-readers.ts +0 -257
  445. package/src/check/store-ms.ts +0 -72
  446. package/src/check/store-names.ts +0 -88
  447. package/src/check/test-helpers.ts +0 -98
  448. package/src/check/ttl-names.ts +0 -142
  449. package/src/compiler/deprecated-ai-labels.ts +0 -97
  450. package/src/compiler/deprecated-ai-links.ts +0 -63
  451. package/src/compiler/deprecated-allow.ts +0 -50
  452. package/src/compiler/deprecated-auth-lints.ts +0 -14
  453. package/src/compiler/deprecated-auth-signed.ts +0 -29
  454. package/src/compiler/deprecated-children.ts +0 -66
  455. package/src/compiler/deprecated-image.ts +0 -116
  456. package/src/compiler/deprecated-island.ts +0 -155
  457. package/src/compiler/deprecated-lints-1-105.ts +0 -41
  458. package/src/compiler/deprecated-page.ts +0 -125
  459. package/src/compiler/deprecated-parts.ts +0 -22
  460. package/src/compiler/deprecated-typed-lints.ts +0 -23
  461. package/src/compiler/deprecated-ui-callbacks.ts +0 -66
  462. package/src/compiler/deprecated-ui-input.ts +0 -97
  463. package/src/compiler/deprecated-ui-items.ts +0 -47
  464. package/src/compiler/old-parts.ts +0 -84
  465. package/src/runtime/mount.compat.ts +0 -8
  466. package/src/server/moved-exports.ts +0 -17
  467. package/types/check/action-readers.d.ts +0 -3
  468. package/types/check/action-readers.d.ts.map +0 -1
  469. package/types/check/action-type.d.ts +0 -3
  470. package/types/check/action-type.d.ts.map +0 -1
  471. package/types/check/ai-language.d.ts +0 -3
  472. package/types/check/ai-language.d.ts.map +0 -1
  473. package/types/check/app-hooks.d.ts +0 -3
  474. package/types/check/app-hooks.d.ts.map +0 -1
  475. package/types/check/auth-methods.d.ts +0 -3
  476. package/types/check/auth-methods.d.ts.map +0 -1
  477. package/types/check/auth-rate-limits.d.ts +0 -3
  478. package/types/check/auth-rate-limits.d.ts.map +0 -1
  479. package/types/check/call-result.d.ts +0 -7
  480. package/types/check/call-result.d.ts.map +0 -1
  481. package/types/check/client-keys.d.ts +0 -3
  482. package/types/check/client-keys.d.ts.map +0 -1
  483. package/types/check/cms-options.d.ts +0 -3
  484. package/types/check/cms-options.d.ts.map +0 -1
  485. package/types/check/config-groups.d.ts +0 -3
  486. package/types/check/config-groups.d.ts.map +0 -1
  487. package/types/check/config-switches.d.ts +0 -3
  488. package/types/check/config-switches.d.ts.map +0 -1
  489. package/types/check/context-import.d.ts +0 -3
  490. package/types/check/context-import.d.ts.map +0 -1
  491. package/types/check/env-files.d.ts +0 -3
  492. package/types/check/env-files.d.ts.map +0 -1
  493. package/types/check/format-duration.d.ts +0 -5
  494. package/types/check/format-duration.d.ts.map +0 -1
  495. package/types/check/guard-options.d.ts +0 -3
  496. package/types/check/guard-options.d.ts.map +0 -1
  497. package/types/check/handler-events.d.ts +0 -9
  498. package/types/check/handler-events.d.ts.map +0 -1
  499. package/types/check/hook-context.d.ts +0 -3
  500. package/types/check/hook-context.d.ts.map +0 -1
  501. package/types/check/hook-names.d.ts +0 -3
  502. package/types/check/hook-names.d.ts.map +0 -1
  503. package/types/check/i18n-keys.d.ts +0 -3
  504. package/types/check/i18n-keys.d.ts.map +0 -1
  505. package/types/check/images-keys.d.ts +0 -3
  506. package/types/check/images-keys.d.ts.map +0 -1
  507. package/types/check/job-shapes.d.ts +0 -6
  508. package/types/check/job-shapes.d.ts.map +0 -1
  509. package/types/check/link-flag-tests.d.ts +0 -4
  510. package/types/check/link-flag-tests.d.ts.map +0 -1
  511. package/types/check/live-api.d.ts +0 -3
  512. package/types/check/live-api.d.ts.map +0 -1
  513. package/types/check/mail-api.d.ts +0 -3
  514. package/types/check/mail-api.d.ts.map +0 -1
  515. package/types/check/one-state-api.d.ts +0 -9
  516. package/types/check/one-state-api.d.ts.map +0 -1
  517. package/types/check/pages-options.d.ts +0 -3
  518. package/types/check/pages-options.d.ts.map +0 -1
  519. package/types/check/rate-enforce.d.ts +0 -3
  520. package/types/check/rate-enforce.d.ts.map +0 -1
  521. package/types/check/refusal-calls.d.ts +0 -3
  522. package/types/check/refusal-calls.d.ts.map +0 -1
  523. package/types/check/retired-lints.d.ts +0 -3
  524. package/types/check/retired-lints.d.ts.map +0 -1
  525. package/types/check/route-keys.d.ts +0 -3
  526. package/types/check/route-keys.d.ts.map +0 -1
  527. package/types/check/secret-keys.d.ts +0 -3
  528. package/types/check/secret-keys.d.ts.map +0 -1
  529. package/types/check/socket-frames.d.ts +0 -3
  530. package/types/check/socket-frames.d.ts.map +0 -1
  531. package/types/check/source-readers.d.ts +0 -3
  532. package/types/check/source-readers.d.ts.map +0 -1
  533. package/types/check/store-ms.d.ts +0 -3
  534. package/types/check/store-ms.d.ts.map +0 -1
  535. package/types/check/store-names.d.ts +0 -3
  536. package/types/check/store-names.d.ts.map +0 -1
  537. package/types/check/test-helpers.d.ts +0 -3
  538. package/types/check/test-helpers.d.ts.map +0 -1
  539. package/types/check/ttl-names.d.ts +0 -3
  540. package/types/check/ttl-names.d.ts.map +0 -1
  541. package/types/compiler/deprecated-ai-labels.d.ts +0 -5
  542. package/types/compiler/deprecated-ai-labels.d.ts.map +0 -1
  543. package/types/compiler/deprecated-ai-links.d.ts +0 -5
  544. package/types/compiler/deprecated-ai-links.d.ts.map +0 -1
  545. package/types/compiler/deprecated-allow.d.ts +0 -5
  546. package/types/compiler/deprecated-allow.d.ts.map +0 -1
  547. package/types/compiler/deprecated-auth-lints.d.ts +0 -12
  548. package/types/compiler/deprecated-auth-lints.d.ts.map +0 -1
  549. package/types/compiler/deprecated-auth-signed.d.ts +0 -5
  550. package/types/compiler/deprecated-auth-signed.d.ts.map +0 -1
  551. package/types/compiler/deprecated-children.d.ts +0 -4
  552. package/types/compiler/deprecated-children.d.ts.map +0 -1
  553. package/types/compiler/deprecated-image.d.ts +0 -5
  554. package/types/compiler/deprecated-image.d.ts.map +0 -1
  555. package/types/compiler/deprecated-island.d.ts +0 -9
  556. package/types/compiler/deprecated-island.d.ts.map +0 -1
  557. package/types/compiler/deprecated-lints-1-105.d.ts +0 -39
  558. package/types/compiler/deprecated-lints-1-105.d.ts.map +0 -1
  559. package/types/compiler/deprecated-page.d.ts +0 -4
  560. package/types/compiler/deprecated-page.d.ts.map +0 -1
  561. package/types/compiler/deprecated-parts.d.ts +0 -3
  562. package/types/compiler/deprecated-parts.d.ts.map +0 -1
  563. package/types/compiler/deprecated-typed-lints.d.ts +0 -21
  564. package/types/compiler/deprecated-typed-lints.d.ts.map +0 -1
  565. package/types/compiler/deprecated-ui-callbacks.d.ts +0 -5
  566. package/types/compiler/deprecated-ui-callbacks.d.ts.map +0 -1
  567. package/types/compiler/deprecated-ui-input.d.ts +0 -5
  568. package/types/compiler/deprecated-ui-input.d.ts.map +0 -1
  569. package/types/compiler/deprecated-ui-items.d.ts +0 -5
  570. package/types/compiler/deprecated-ui-items.d.ts.map +0 -1
  571. package/types/compiler/old-parts.d.ts +0 -9
  572. package/types/compiler/old-parts.d.ts.map +0 -1
  573. package/types/runtime/mount.compat.d.ts +0 -7
  574. package/types/runtime/mount.compat.d.ts.map +0 -1
  575. package/types/server/moved-exports.d.ts +0 -12
  576. package/types/server/moved-exports.d.ts.map +0 -1
@@ -1,34 +1,12 @@
1
- import type { CheckDiagnostic } from '.'
2
- import type { LintLevels } from '../compiler/lints'
3
1
  import { writeFile } from 'node:fs/promises'
4
2
  import { basename } from 'node:path'
5
3
  import { findProjectFiles } from '../build/files'
6
- import { lintLevel } from '../compiler/lints'
7
- import { OLD_PACKAGE_NAME, RENAMED_IN, RENAMED_PACKAGES } from '../package-names'
4
+
5
+ import { OLD_PACKAGE_NAME, RENAMED_PACKAGES } from '../package-names'
8
6
 
9
7
  // The files that name a package: the scripts, components and stylesheets of the project, and its manifest and tsconfigs.
10
8
  const NAMING_FILE = /^(?:package\.json|tsconfig[\w.-]*\.json)$|\.(?:[cm]?[jt]sx?|kay|css)$/
11
9
 
12
- // The version a manifest entry asks of the package: after a key, `"@kaynooo/kayjs-ui": "~1.103.0"`, or after an alias, `npm:@kaynooo/kayjs@~1.103.0`.
13
- const RANGE_AFTER_KEY = /"\s*:\s*"[~^]?(\d+\.\d+\.\d+)(?=")/y
14
- const RANGE_AFTER_ALIAS = /@[~^]?(\d+\.\d+\.\d+)(?=")/y
15
-
16
- // The range's version, when it is below the first one published under the new names, which no version of the new package satisfies: written as that first version, keeping its `~` or `^`.
17
- function raisedRange(source: string, from: number): { start: number, end: number, text: string } | undefined {
18
- const pattern = source[from] === '"' ? RANGE_AFTER_KEY : RANGE_AFTER_ALIAS
19
-
20
- pattern.lastIndex = from
21
-
22
- const found = pattern.exec(source)
23
-
24
- if (found === null || Bun.semver.order(found[1]!, RENAMED_IN) !== -1)
25
- return undefined
26
-
27
- const start = from + found[0].length - found[1]!.length
28
-
29
- return { start, end: start + found[1]!.length, text: RENAMED_IN }
30
- }
31
-
32
10
  const BLOCK_COMMENT = /\/\*[\s\S]*?(?:\*\/|$)/g
33
11
 
34
12
  // What a name may follow inside its string: nothing, an alias, or a path through node_modules, as a stylesheet's `@source`.
@@ -86,7 +64,7 @@ function kindOf(file: string): Kind {
86
64
  return file.endsWith('.css') ? 'stylesheet' : 'script'
87
65
  }
88
66
 
89
- // The position of each old package name a file depends on, as the lint and `kay upgrade` rewrite them.
67
+ // The position of each old package name a file depends on, as `kay upgrade` rewrites them.
90
68
  export function oldNamesIn(file: string, source: string): RegExpExecArray[] {
91
69
  const kind = kindOf(file)
92
70
  const comments = kind === 'manifest' || kind === 'tsconfig' ? [] : [...source.matchAll(BLOCK_COMMENT)].map((c): [number, number] => [c.index, c.index + c[0].length])
@@ -117,41 +95,3 @@ export async function renameProjectFiles(root: string): Promise<void> {
117
95
  await writeFile(file, renamed + source.slice(from))
118
96
  }
119
97
  }
120
-
121
- // kay and its libraries under the `@kaynooo` scope, named as an import, `require` or `import()` specifier, a config key, a stylesheet's `@import` or `@plugin` path or a package.json entry, which are `@kayjs/*` since 1.104: each name found gets a safe fix writing the new one.
122
- // A package.json that lists the new name already would get the entry twice, so its names are reported with a fix that is not safe; one that does not has the range raised to the first version under the new name.
123
- export async function renamedPackages(root: string, levels: LintLevels | undefined): Promise<CheckDiagnostic[]> {
124
- const level = lintLevel('deprecated-package-names', levels)
125
-
126
- if (level === 'allow')
127
- return []
128
-
129
- const found: CheckDiagnostic[] = []
130
-
131
- for (const file of (await findProjectFiles(root, NAMING_FILE, { project: true, ownKayOnly: true })).sort()) {
132
- const source = await Bun.file(file).text()
133
- const manifest = basename(file) === 'package.json'
134
-
135
- for (const match of oldNamesIn(file, source)) {
136
- const name = match[0]
137
-
138
- const next = RENAMED_PACKAGES[name]!
139
- const before = source.slice(0, match.index).split('\n')
140
- const raised = manifest ? raisedRange(source, match.index + name.length) : undefined
141
-
142
- found.push({
143
- file,
144
- line: before.length,
145
- column: before.at(-1)!.length + 1,
146
- end: match.index + name.length,
147
- severity: level === 'warn' ? 'warning' : 'error',
148
- code: 'deprecated-package-names',
149
- message: `\`${name}\` is \`${next}\` since 1.104: kay and its libraries are published under the \`@kayjs\` scope`,
150
- help: manifest ? `write \`${next}\` and run \`bun install\`, or run \`kay upgrade\`` : `import from \`${next}\``,
151
- fixes: [{ title: `write ${next}`, safe: !manifest || !source.includes(`"${next}"`), edits: [{ start: match.index, end: match.index + name.length, text: next }, ...raised === undefined ? [] : [raised]] }],
152
- })
153
- }
154
- }
155
-
156
- return found
157
- }
@@ -9,13 +9,13 @@ import type { ApiModule } from '../server/api-modules'
9
9
  import type { PublicFile } from '../server/public'
10
10
  import type { Endpoint, Route, RouteMount } from '../server/routes'
11
11
  import type { ShadowFile, ShadowOptions, ShadowSettings } from './shadow'
12
- import { existsSync, realpathSync } from 'node:fs'
12
+ import { existsSync } from 'node:fs'
13
13
  import { lstat, mkdir, readdir, readlink, rm, symlink, unlink } from 'node:fs/promises'
14
- import { basename, dirname, join, relative, resolve, sep } from 'node:path'
14
+ import { dirname, join, relative, resolve, sep } from 'node:path'
15
15
  import { readCacheEntry, writeCacheEntry } from '../build/cache'
16
16
  import { findKayFiles, inWalkScope, treeEntries, writeIfChanged } from '../build/files'
17
17
  import { iconTypes } from '../build/icons'
18
- import { findKayLibraries, libraryOf, packageRoot, reachableLibraryFiles, throughNodeModules } from '../build/libraries'
18
+ import { extensionPackages, findKayLibraries, libraryOf, linkedOutside, reachableLibraryFiles, throughNodeModules } from '../build/libraries'
19
19
  import { packageContextModule } from '../build/manifests'
20
20
  import { isPageFile, mountedPageDirs } from '../build/page-dirs'
21
21
  import { importedSignals } from '../build/signals'
@@ -34,68 +34,27 @@ import { extensionEditor, patternShapes, routeMounts, scanEndpoints, scanRoutes,
34
34
  import { readRuntimeRedirects } from '../server/runtime-redirects'
35
35
 
36
36
  import { actionOptions } from './action-options'
37
- import { actionReaders } from './action-readers'
38
- import { actionType } from './action-type'
39
- import { aiLanguage } from './ai-language'
40
- import { appHooks } from './app-hooks'
41
- import { authMethods } from './auth-methods'
42
- import { authRateLimits } from './auth-rate-limits'
43
- import { clientKeys } from './client-keys'
44
- import { cmsOptions } from './cms-options'
45
- import { configGroups } from './config-groups'
46
- import { configSwitches } from './config-switches'
47
- import { contextImport } from './context-import'
48
37
 
49
38
  import { ownFile } from './diagnose'
50
39
  import { endpointExports } from './endpoint-exports'
51
-
52
- import { envFiles } from './env-files'
53
40
  import { ASSET_TYPES, environmentTypes, kayPaths, packageTypes } from './env-types'
54
-
55
- import { formatDurationNumbers } from './format-duration'
56
41
  import { CONTENT_CHECK, EXPORTS_CHECK, exportsCheck, SETTINGS_CHECK, settingsCheck } from './generated'
57
-
58
- import { guardOptions } from './guard-options'
59
42
  import { unguardedRoutes, unguardedTools } from './guards'
60
- import { hookContext } from './hook-context'
61
- import { hookNames } from './hook-names'
62
- import { i18nKeys } from './i18n-keys'
63
-
64
- import { imagesKeys } from './images-keys'
65
43
  import { islandOnlyComponents } from './island-only'
66
-
67
- import { diskFilesCalls, jobHandlers, jobOptions, scheduleCalls } from './job-shapes'
68
-
69
44
  import { largePublicImages } from './large-images'
70
- import { liveApi } from './live-api'
71
-
72
- import { mailApi } from './mail-api'
73
45
  import { mcpRoutes } from './mcp-routes'
74
- import { islandEvents, listenTarget, movedImports, navigateQuery, navigationHooks, persistedCall, persistedQuery } from './one-state-api'
75
46
  import { unreadOpenSettings } from './open-settings'
76
- import { pagesOptions } from './pages-options'
77
47
  import { publicEnvOutsideSrc } from './public-env-outside-src'
78
- import { rateEnforce } from './rate-enforce'
79
- import { refusalCalls } from './refusal-calls'
80
48
  import { removedUiTokens } from './removed-ui-tokens'
81
- import { retiredLintLevels } from './retired-lints'
82
- import { routeKeys } from './route-keys'
83
49
  import { routeShadow, routeShadowPath } from './route-shadow'
84
50
  import { schemaBuilders } from './schema-builders'
85
51
  import { schemaJson } from './schema-json'
86
- import { secretKeys } from './secret-keys'
87
52
  import { compileShadow, guardTypes, layoutQueries, matcherSource, outerSlots, pageRoute, serializeShadowSettings, SHADOW_SETTINGS, shadowOptionsFor, shadowPath } from './shadow'
88
- import { socketFrames } from './socket-frames'
89
53
  import { untypedSockets } from './socket-routes'
90
- import { sourceReaders } from './source-readers'
91
54
  import { unusedStatusPages } from './status-pages'
92
- import { storeMs } from './store-ms'
93
- import { storeNames } from './store-names'
94
- import { testHelpers } from './test-helpers'
95
55
  import { textSizeColour } from './text-size-colour'
96
56
  import { unknownToolLabels } from './tool-labels'
97
57
  import { typingOptions } from './tsgo'
98
- import { ttlNames } from './ttl-names'
99
58
 
100
59
  import { uiTypes } from './ui-types'
101
60
  import { unmountedJobs } from './unmounted-jobs'
@@ -194,55 +153,10 @@ const PROJECT_CHECKS: ((input: ProjectCheckInput) => CheckDiagnostic[] | Promise
194
153
  async ({ root, options }) => unknownToolLabels(root, options),
195
154
  async ({ root, options }) => publicEnvOutsideSrc(root, options),
196
155
  ({ root, options }) => unmountedJobs(root, options),
197
- async ({ root, options }) => sourceReaders(root, options),
198
- async ({ root, options }) => actionReaders(root, options),
199
- async ({ root, options }) => liveApi(root, options),
200
- async ({ root, options }) => actionType(root, options),
201
- async ({ root, options }) => socketFrames(root, options),
202
156
  async ({ root, options, served }) => unusedStatusPages(root, options, served),
203
-
204
- async ({ root, options }) => persistedCall(root, options),
205
- async ({ root, options }) => persistedQuery(root, options),
206
- async ({ root, options }) => navigateQuery(root, options),
207
- async ({ root, options }) => navigationHooks(root, options),
208
- async ({ root, options }) => islandEvents(root, options),
209
- async ({ root, options }) => listenTarget(root, options),
210
- async ({ root, options }) => movedImports(root, options),
211
-
212
157
  async ({ root, options }) => schemaBuilders(root, options),
213
158
  async ({ root, options }) => schemaJson(root, options),
214
159
  async ({ root, options }) => actionOptions(root, options),
215
- async ({ root, options }) => aiLanguage(root, options),
216
- async ({ root, options }) => hookNames(root, options),
217
- async ({ root, options }) => mailApi(root, options),
218
- async ({ root, options }) => testHelpers(root, options),
219
- async ({ root, options }) => cmsOptions(root, options),
220
- async ({ root, options }) => jobHandlers(root, options),
221
- async ({ root, options }) => scheduleCalls(root, options),
222
- async ({ root, options }) => jobOptions(root, options),
223
- async ({ root, options }) => diskFilesCalls(root, options),
224
- async ({ root, options }) => storeNames(root, options),
225
- async ({ root, options }) => formatDurationNumbers(root, options),
226
- async ({ root, options }) => guardOptions(root, options),
227
- async ({ root, options }) => configSwitches(root, options),
228
- async ({ root, options }) => imagesKeys(root, options),
229
- async ({ root, options }) => clientKeys(root, options),
230
- async ({ root, options }) => retiredLintLevels(root, options),
231
- async ({ root, options }) => configGroups(root, options),
232
- async ({ root, options }) => i18nKeys(root, options),
233
- async ({ root, options }) => secretKeys(root, options),
234
- async ({ root, options }) => routeKeys(root, options),
235
- async ({ root, options }) => appHooks(root, options),
236
- async ({ root, options }) => hookContext(root, options),
237
- async ({ root, options }) => pagesOptions(root, options),
238
- async ({ root, options }) => ttlNames(root, options),
239
- async ({ root, options }) => storeMs(root, options),
240
- async ({ root, options }) => rateEnforce(root, options),
241
- async ({ root, options }) => refusalCalls(root, options),
242
- async ({ root, options }) => authRateLimits(root, options),
243
- async ({ root, options }) => authMethods(root, options),
244
- async ({ root, options }) => envFiles(root, options),
245
- async ({ root, options }) => contextImport(root, options),
246
160
  ]
247
161
 
248
162
  async function writeShadows(projectRoot: string, options: CheckOptions): Promise<ShadowTypes> {
@@ -389,7 +303,7 @@ async function libraryShadows(root: string, options: CheckOptions, own: string[]
389
303
  const { routes: routesDir, cache: cacheDir } = projectPaths(root, options)
390
304
  const libraries = await findKayLibraries(root)
391
305
  // The app's own directories are checked already; a linked library has its real path outside any `node_modules`, an installed one inside.
392
- const linked = (path: string) => !ownFile(root, path) && existsSync(path) && !realpathSync(path).split(sep).includes('node_modules')
306
+ const linked = (path: string) => linkedOutside(root, path)
393
307
  const local = mounts.filter(mount => linked(mount.dir))
394
308
  const diagnostics: CheckDiagnostic[] = []
395
309
  const editor = editorOf(root, options.extensions, diagnostics)
@@ -545,20 +459,6 @@ async function linkDependencies(root: string, { dir, realDir }: KayLibrary, own:
545
459
  }
546
460
  }
547
461
 
548
- // The package holding each of `extensionDirs`, an extension's routes or its editor's directory, that no kay library holds, the nearest directory above them with a package.json, as a library: its components are shadowed and reached as one's are.
549
- async function extensionPackages(root: string, libraries: KayLibrary[], extensionDirs: string[]): Promise<KayLibrary[]> {
550
- const dirs = new Set(extensionDirs.filter(dir => libraryOf(libraries, join(dir, 'page.kay')) === undefined).map(packageRoot))
551
-
552
- const realRoot = realpathSync(root)
553
-
554
- return Promise.all([...dirs].map(async (dir) => {
555
- // Left out: the app itself, when the package holds it as a fixture; the other projects inside it, to their own checks; a kay library's files, to the library. A package linked into `node_modules` goes by that path, as the app imports it.
556
- const files = (await findKayFiles(dir, { project: true, ownOnly: true, ownKayOnly: true })).filter(file => !realpathSync(file).startsWith(realRoot + sep) && libraryOf(libraries, file) === undefined)
557
-
558
- return { name: basename(dir), dir, realDir: realpathSync(dir), files, specifiers: new Map<string, string>(), exports: undefined, extension: true as const }
559
- }))
560
- }
561
-
562
462
  // The pages, public files, API modules and endpoints, with the locale settings, each with the reason the server would refuse it reported.
563
463
  async function servedProject(root: string, options: CheckOptions, problems: CheckDiagnostic[], mounts: RouteMount[]): Promise<ServedProject> {
564
464
  const paths = projectPaths(root, options)
@@ -403,10 +403,10 @@ async function declareRawReads(root: string, problems: CheckDiagnostic[], format
403
403
  return problems.filter(problem => !declared.names.has(UNDECLARED_READ.exec(problem.message)?.[1] ?? ''))
404
404
  }
405
405
 
406
- // What `envFiles` in kay.config.ts has compared: the declared variables against the compose and example files it names, else against the project's production compose files and `.env.example`; `env: false` compares nothing.
406
+ // What `envFiles` in kay.config.ts has compared: the declared variables against the compose and example files it names, else against the project's production compose files and `.env.example`; `envFiles: false` compares nothing.
407
407
  async function envProblems(root: string, config: KayConfig, scope: string[]): Promise<CheckDiagnostic[]> {
408
408
  const { compareEnv, defaultEnvFiles } = await import('./env-compare')
409
- const setting = config.envFiles ?? config.env
409
+ const setting = config.envFiles
410
410
  const files = setting === false ? undefined : bagOf(setting) ?? await defaultEnvFiles(root)
411
411
 
412
412
  if (files === undefined)
@@ -2,8 +2,10 @@ import type { EnvVariable } from '../server/env'
2
2
  import type { EnvSchemaRecord } from '../server/env-state'
3
3
  import type { Command } from './command'
4
4
  import type { EnvFiles } from './env-compare'
5
+ import { existsSync } from 'node:fs'
5
6
  import { readFile, writeFile } from 'node:fs/promises'
6
- import { join, relative, resolve } from 'node:path'
7
+ import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path'
8
+ import { CONFIG_FILE } from '../config'
7
9
  import { loadConfigWithin } from '../config-loader'
8
10
  import { bagOf } from '../config-switch'
9
11
  import { projectPaths } from '../project'
@@ -110,11 +112,26 @@ export const env: Command = {
110
112
  // The files kay.config.ts names, else the project's own; none when `envFiles` is `false`.
111
113
  async function configuredEnvFiles(root: string): Promise<EnvFiles | undefined> {
112
114
  const config = await loadConfigWithin(root)
113
- const env = config.envFiles ?? config.env
115
+ const env = config.envFiles
114
116
 
115
117
  return env === false ? undefined : bagOf(env) ?? await defaultEnvFiles(root)
116
118
  }
117
119
 
120
+ // Whether `file` is under `root` and not under a project of its own nested inside it.
121
+ function ownedBy(root: string, file: string): boolean {
122
+ const path = relative(root, file)
123
+
124
+ if (path === '..' || path.startsWith(`..${sep}`) || isAbsolute(path))
125
+ return false
126
+
127
+ for (let dir = dirname(file); dir !== root && dir.length > root.length; dir = dirname(dir)) {
128
+ if (existsSync(join(dir, CONFIG_FILE)))
129
+ return false
130
+ }
131
+
132
+ return true
133
+ }
134
+
118
135
  // The path of an extension's module relative to the root, none when it does not resolve, which the build reports.
119
136
  function resolvedUnder(root: string, path: string): string[] {
120
137
  try {
@@ -126,8 +143,10 @@ function resolvedUnder(root: string, path: string): string[] {
126
143
  }
127
144
 
128
145
  export async function listEnv(root: string): Promise<{ variables: Listed[], unread: { file: string, error: string }[] }> {
146
+ const recorded = listingEnv()
147
+ // A call with no file to place it is this project's only when made while it loads.
148
+ const mark = recorded.length
129
149
  const config = await loadConfigWithin(root)
130
- const declared = listingEnv()
131
150
  const shown = (file: string) => relative(root, file)
132
151
  const unread: { file: string, error: string }[] = []
133
152
  // The server entry listens as it is imported, so its own schema is left out.
@@ -154,6 +173,9 @@ export async function listEnv(root: string): Promise<{ variables: Listed[], unre
154
173
  }
155
174
  }
156
175
 
176
+ // The calls of this project only, each module's last: a module the config imported and one read again by an earlier listing of this process are counted once.
177
+ const declared = [...new Map(recorded.filter(({ file }, index) => file === undefined ? index >= mark : ownedBy(root, file)).map(call => [`${call.file}:${Object.keys(call.schema.properties).join()}`, call])).values()]
178
+
157
179
  // A library built at import time declares its own variables for the app, which says more than the extension's list, so the list adds only the rest.
158
180
  const declaredNames = new Set(declared.flatMap(({ schema }) => Object.keys(schema.properties)))
159
181
  const variables: Listed[] = [
@@ -3,7 +3,6 @@ import type { FieldContent, FormInfo } from './form-info'
3
3
  import type { IslandDeclaration } from './island-declaration'
4
4
  import { actionOf, componentAction } from './form-action'
5
5
  import { formTargets, initialHelpers } from './form-info'
6
- import { oldPartsClass } from './old-parts'
7
6
  import { childBlocks, visitNodes, walkNodes } from './template-walk'
8
7
 
9
8
  export { actionOf, componentAction } from './form-action'
@@ -230,10 +229,9 @@ export function sectionOf(element: ElementNode, source: string): Extract<Attribu
230
229
  return attribute?.kind === 'boolean' || attribute?.kind === 'expression' ? attribute : undefined
231
230
  }
232
231
 
233
- // `Card(server)` renders per request inside a prerendered page, `Card(server defer)` once the browser fetches it on approach (`server="defer"` before 1.105).
232
+ // `Card(server)` renders per request inside a prerendered page, `Card(server defer)` once the browser fetches it on approach.
234
233
  export const SERVER_ISLAND_ATTRIBUTE = 'server'
235
234
  export const SERVER_ISLAND_DEFER = 'defer'
236
- export const SERVER_ISLAND_MODES = new Set(['defer'])
237
235
  // Beside `defer`, the text of a link to the page with the island in place, for a browser without JavaScript.
238
236
  export const SERVER_ISLAND_NOSCRIPT = 'noscript'
239
237
  // The block under a deferred server island call, or at the root of the component, shown once the island failed for good.
@@ -243,7 +241,7 @@ export const SERVER_IN_ISLAND = '`server` has no effect inside an island'
243
241
 
244
242
  export interface ServerIslandMark {
245
243
  attribute: NamedAttribute
246
- // Undefined for a value no mode answers to.
244
+ // Undefined for a value, which no mode answers to.
247
245
  mode: 'inline' | 'defer' | undefined
248
246
  noscript: NamedAttribute | undefined
249
247
  // The bare `defer` written beside `server`, the word of `server defer`, which is no prop either.
@@ -263,8 +261,7 @@ export function serverIslandOf(element: ElementNode, source: string): ServerIsla
263
261
 
264
262
  // `defer` is the mark only as a bare word beside `server`: alone, or with a value, it is a prop of the component, which may have one of its own.
265
263
  const defer = [named(SERVER_ISLAND_DEFER)].find(candidate => candidate?.kind === 'boolean')
266
- const written = attribute.kind === 'static' && SERVER_ISLAND_MODES.has(attribute.text) ? attribute.text as 'defer' : undefined
267
- const mode = attribute.kind === 'boolean' ? ['inline', 'defer'][Number(defer !== undefined)] as 'inline' | 'defer' : written
264
+ const mode = attribute.kind === 'boolean' ? ['inline', 'defer'][Number(defer !== undefined)] as 'inline' | 'defer' : undefined
268
265
 
269
266
  return { attribute, mode, noscript: named(SERVER_ISLAND_NOSCRIPT), defer }
270
267
  }
@@ -372,7 +369,7 @@ export interface ErrorMessages {
372
369
  describing: Map<string, string>
373
370
  }
374
371
 
375
- const ERROR_READ = /^([\w$.]+?)(?:\.form)?\.error\((?:(['"])([^'"]*)\2)?\)$/
372
+ const ERROR_READ = /^([\w$.]+?)\.form\.error\((?:(['"])([^'"]*)\2)?\)$/
376
373
  const WHITESPACE = /\s+/g
377
374
  const ID_UNSAFE = /[^\w-]+/g
378
375
 
@@ -384,7 +381,7 @@ function errorId(action: string, field: string): string {
384
381
  return `${action.replaceAll('.', '-')}-${field ? `${field.replace(ID_UNSAFE, '-')}-` : ''}error`
385
382
  }
386
383
 
387
- // An `error` line names the message its field is described by; failing one, as before it, the element `if add.form.error('title') then message` and `p {add.form.error('title')}`, and `add.error('title')` until 1.108: the element shown holds the message, outside a `for`, which would repeat its id, for an action a form of the file posts to.
384
+ // An `error` line names the message its field is described by; failing one, as before it, the element `if add.form.error('title') then message` and `p {add.form.error('title')}`: the element shown holds the message, outside a `for`, which would repeat its id, for an action a form of the file posts to.
388
385
  export function errorMessages(nodes: Node[], source: string): ErrorMessages {
389
386
  const found: ErrorMessages = { ids: new Map(), lines: new Map(), describing: new Map() }
390
387
  const posted = new Set<string>()
@@ -492,7 +489,7 @@ export function isChildrenSlot(node: Node): boolean {
492
489
  return isSlot(node) && (node as ElementNode).outlet === undefined
493
490
  }
494
491
 
495
- export type TemplateHelper = 'For' | 'componentClass' | 'partClass' | 'partHanded' | 'partsClass'
492
+ export type TemplateHelper = 'For' | 'componentClass' | 'handParts' | 'partClass' | 'partHanded' | 'partsClass'
496
493
 
497
494
  // Whether an entry of `src/ui.ts` has variants, which read the component's props: without them its parts are static classes, written into the template as they are.
498
495
  export function uiHasVariants(entry: UiEntry): boolean {
@@ -566,9 +563,9 @@ export interface KayFile {
566
563
  style?: Span | undefined
567
564
  // Inside the angle brackets of `--- <T extends Row>`: the component function's type parameters.
568
565
  typeParameters?: Span | undefined
569
- // The `client` of `--- client`: the component renders in the browser only.
566
+ // The `island({ render: 'client' })` call: the component renders in the browser only.
570
567
  client?: Span | undefined
571
- // The `island` or `static` of `--- island` and `--- static`: the author pins the component's role, and the compiler holds it to the pin.
568
+ // The `island()` or `island({ render: 'static' })` call: the author pins the component's role, and the compiler holds it to the pin.
572
569
  pin?: (Span & { kind: 'island' | 'static' }) | undefined
573
570
  // The `island({ ... })` the script opens with, which sets `client` or `pin` as the fence lines do.
574
571
  island?: IslandDeclaration | undefined
@@ -703,8 +700,10 @@ function addRecipe(facts: TemplateFacts, file: KayFile, recipe: string): void {
703
700
  if (facts.parts.root !== 'none')
704
701
  facts.helpers.add('partClass')
705
702
 
706
- if (facts.parts.implicit?.component)
703
+ if (facts.parts.implicit?.component) {
707
704
  facts.helpers.add('partsClass')
705
+ facts.helpers.add('handParts')
706
+ }
708
707
  }
709
708
  }
710
709
 
@@ -747,8 +746,10 @@ function factsOf(file: KayFile): TemplateFacts {
747
746
 
748
747
  facts.helpers.add('partClass')
749
748
 
750
- if (node.component)
749
+ if (node.component) {
751
750
  facts.helpers.add('partsClass')
751
+ facts.helpers.add('handParts')
752
+ }
752
753
 
753
754
  if (index > 0)
754
755
  facts.helpers.add('partHanded')
@@ -783,8 +784,10 @@ function factsOf(file: KayFile): TemplateFacts {
783
784
  if (facts.parts) {
784
785
  markRoot(facts.parts, file.template)
785
786
 
786
- if (facts.parts.implicit?.component)
787
+ if (facts.parts.implicit?.component) {
787
788
  facts.helpers.add('partsClass')
789
+ facts.helpers.add('handParts')
790
+ }
788
791
  }
789
792
 
790
793
  return facts
@@ -795,8 +798,7 @@ function mergesComponentClass(element: ElementNode, source: string): boolean {
795
798
  if (!element.component)
796
799
  return false
797
800
 
798
- const old = oldPartsClass(element, source)
799
- const attribute = element.attributes.find((attribute): attribute is NamedAttribute => attribute.kind !== 'spread' && attribute !== old && source.slice(attribute.name.start, attribute.name.end) === 'class')
801
+ const attribute = element.attributes.find((attribute): attribute is NamedAttribute => attribute.kind !== 'spread' && source.slice(attribute.name.start, attribute.name.end) === 'class')
800
802
 
801
803
  if (element.attributes.some(attribute => attribute.kind === 'spread'))
802
804
  return element.classes.length > 0 || attribute !== undefined
@@ -2,13 +2,11 @@ import type { Diagnostic, Fix, KayFile, Span } from './ast'
2
2
  import type { Node, NodeOfType, Program } from './estree'
3
3
  import type { Path } from './scope'
4
4
  import { visitNodes } from './ast'
5
- import { wordEdit } from './deprecated-island'
6
5
  import { isPlainProperty, parseProgram } from './estree'
7
6
  import { TS_EXPRESSIONS, viaGlobalThis } from './estree-shapes'
8
7
  import { browserGlobals } from './host'
9
8
  import { importEdits } from './import-edits'
10
9
  import { parameterNames } from './items'
11
- import { importedFromKay } from './rewrite-reads'
12
10
  import { analyzeScript } from './script'
13
11
  import { walkScope } from './walk'
14
12
 
@@ -130,7 +128,7 @@ export function browserReads(file: KayFile, island: boolean, serverNames: string
130
128
  const through = path.node.name === 'globalThis' ? viaGlobalThis(path) : undefined
131
129
  const { name } = through ?? path.node
132
130
 
133
- if (!names.has(name) || !path.isReferencedIdentifier() || (through === undefined && path.scope.hasBinding(name, true)) || inType(path) || listenTarget(path))
131
+ if (!names.has(name) || !path.isReferencedIdentifier() || (through === undefined && path.scope.hasBinding(name, true)) || inType(path))
134
132
  return
135
133
 
136
134
  const holder = path.parentPath!.node
@@ -253,15 +251,6 @@ function inChain(path: Path): boolean {
253
251
  return false
254
252
  }
255
253
 
256
- // A read in the target of `listen(window, 'keydown', ...)`, which the compiler hands `listen` as a function the browser calls.
257
- function listenTarget(path: Path): boolean {
258
- return path.find((parent) => {
259
- const call = parent.parentPath?.node
260
-
261
- return call?.type === 'CallExpression' && call.arguments[0] === parent.node && importedFromKay(parent.scope, call.callee) === 'listen'
262
- }) !== null
263
- }
264
-
265
254
  // `memo(() => ...)` and `rows.map(row => ...)` run the function they take before they return.
266
255
  function rendersCallback(call: NodeOfType<'CallExpression'>, fn: Node): boolean {
267
256
  if (call.arguments[0] !== fn)
@@ -464,6 +453,5 @@ function clientFix(file: KayFile): Fix[] {
464
453
 
465
454
  const call = { start: file.script.start, end: file.script.start, text: 'island({ render: \'client\' })\n' }
466
455
 
467
- // The fence's own pin word goes: it would win over the call.
468
- return [{ title, edits: file.pin === undefined || file.scriptLine === undefined ? [call] : [wordEdit(file.scriptLine, file.pin.end, file.source.slice(0, file.scriptLine.start)), call] }]
456
+ return [{ title, edits: [call] }]
469
457
  }
@@ -0,0 +1,16 @@
1
+ // A source of a merged class: a literal kept as text, so the ones side by side resolve together, or code that writes the value.
2
+ export type ClassItem = { text: string } | { emit: () => void }
3
+
4
+ // The items with each run of literals side by side joined into one.
5
+ export function joinTexts(items: ClassItem[], join: (texts: string[]) => string): ClassItem[] {
6
+ return items.reduce<ClassItem[]>((merged, item) => {
7
+ const last = merged.at(-1)
8
+
9
+ if ('text' in item && last !== undefined && 'text' in last)
10
+ merged[merged.length - 1] = { text: join([last.text, item.text]) }
11
+ else
12
+ merged.push(item)
13
+
14
+ return merged
15
+ }, [])
16
+ }
@@ -18,7 +18,7 @@ import { emitHeadTag, emitHeadText } from './head-tags'
18
18
  import { awaitAlertTail, htmlHelperImport, HtmlTemplate } from './html'
19
19
  import { withoutComma } from './import-edits'
20
20
  import { sourceLocator } from './inspect'
21
- import { asksOf, exportsIslandOptions, islandMessages, withAlertKeys } from './island-arguments'
21
+ import { islandMessages, withAlertKeys } from './island-arguments'
22
22
  import { ambientHelpers, constDeclaration } from './items'
23
23
  import { JsxTemplate } from './jsx'
24
24
  import { lazyDomImport, lazyEdits, lazyNoteImport } from './lazy-imports'
@@ -51,7 +51,7 @@ export interface GenerateOptions {
51
51
  island?: string | undefined
52
52
  // Under `kay dev`, why the component is an island or may become one, written on its slot as `data-why`.
53
53
  cause?: string | undefined
54
- // The island renders in the browser only: `--- client`, or a package it imports cannot load on the server.
54
+ // The island renders in the browser only: `island({ render: 'client' })`, or a package it imports cannot load on the server.
55
55
  client?: boolean | undefined
56
56
  // The live values the island imports, which its server render notes to prove the page may follow them even when the render reads none, as a handler does not run there.
57
57
  lives?: string[] | undefined
@@ -487,7 +487,7 @@ class ModuleShell {
487
487
  })
488
488
  const object = `{ ${entries.join('; ')} }`
489
489
 
490
- const type = `{ class?: ${parts.root === 'none' ? `{ kayError: 'A template with several top elements takes its classes as parts={{ head: "p-6" }}: mark one with part="root" to take a string' }` : `string | readonly unknown[] | Record<string, boolean | null | undefined> | { kayError: 'A parts object is the parts attribute: write parts={{ head: "p-6" }}' }`} | undefined; parts?: ${object} | undefined }`
490
+ const type = `{ class?: ${parts.root === 'none' ? `{ kayError: 'A template with several top elements takes its classes as parts={{ head: "p-6" }}: mark one with part="root" to take a string' }` : `string | readonly unknown[] | Record<string, boolean | null | undefined>`} | undefined; parts?: ${object} | undefined }`
491
491
  const recipe = this.facts.recipe
492
492
 
493
493
  // The variants of the recipe, typed off it, so the component declares them once.
@@ -624,11 +624,11 @@ class ModuleShell {
624
624
  b.add(`\nexport default KayIsland(${JSON.stringify(this.options.island)}, ${name}${this.genericComponent ? ' as never' : ''}${this.islandTail(src)})${this.genericIslandType()}${widened ? this.widenedCall(`typeof ${name}`) : ''}\n`)
625
625
  }
626
626
 
627
- // The arguments after the component that `island()` takes: its message keys, the live values and cause of a server render, and the `island` the module fence exports, the hydrate and persist the component asks for wherever it is used.
627
+ // The arguments after the component that `island()` takes: its message keys, the live values and cause of a server render, and what its `island()` call asks, the hydrate and persist the component asks for wherever it is used.
628
628
  private islandTail(src: string): string {
629
629
  const html = this.options.output === 'html'
630
630
 
631
- return islandMessages(withAlertKeys(src, this.options.awaitAlert), this.options.client, html ? this.options.lives : undefined, html ? this.options.cause : undefined, false, html && exportsIslandOptions(this.script) && asksOf(this.script), this.file.wrapsButtons === true)
631
+ return islandMessages(withAlertKeys(src, this.options.awaitAlert), this.options.client, html ? this.options.lives : undefined, html ? this.options.cause : undefined, false, html && (this.script.island?.asks ?? false), this.file.wrapsButtons === true)
632
632
  }
633
633
 
634
634
  private get wrapped(): boolean {
@@ -1006,13 +1006,13 @@ export function isInteractive(file: KayFile, script: ScriptAnalysis): boolean {
1006
1006
  return script.reactive || templateFacts(file).interactive
1007
1007
  }
1008
1008
 
1009
- // The first thing that makes a component interactive, so an island: an `on*`, `bind:` or `ref` attribute, a `kay` value of the script, a `--- client` fence or a `--- island` one.
1009
+ // The first thing that makes a component interactive, so an island: an `on*`, `bind:` or `ref` attribute, a `kay` value of the script, or an `island()` declaration.
1010
1010
  export function islandCause(file: KayFile, script: ScriptAnalysis): IslandCause | undefined {
1011
1011
  if (file.client !== undefined)
1012
- return { kind: 'client', name: file.island === undefined ? '--- client' : 'island()', span: file.client, line: lineOf(file.source, file.client.start) }
1012
+ return { kind: 'client', name: 'island()', span: file.client, line: lineOf(file.source, file.client.start) }
1013
1013
 
1014
1014
  if (file.pin?.kind === 'island')
1015
- return { kind: 'island', name: file.island === undefined ? '--- island' : 'island()', span: file.pin, line: lineOf(file.source, file.pin.start) }
1015
+ return { kind: 'island', name: 'island()', span: file.pin, line: lineOf(file.source, file.pin.start) }
1016
1016
 
1017
1017
  let cause: IslandCause | undefined
1018
1018
 
@@ -0,0 +1,22 @@
1
+ import type { IfBranch, IfNode, Span } from './ast'
2
+
3
+ const UNSET_NAME = /^(?:aria|data)-/
4
+
5
+ function text(src: string, span: Span): string {
6
+ return src.slice(span.start, span.end).trim()
7
+ }
8
+
9
+ // A branch whose test is the literal `false`, which a build writes for a feature no call site uses: it is never taken, so the code leaves it out.
10
+ export function neverTaken(src: string, branch: IfBranch): boolean {
11
+ return branch.alias === undefined && text(src, branch.test) === 'false'
12
+ }
13
+
14
+ // An `if` with no `else` that draws nothing: the markup keeps its markers and the code has no block to run for them.
15
+ export function neverShown(src: string, node: IfNode): boolean {
16
+ return node.fallback === undefined && node.branches.every(branch => neverTaken(src, branch))
17
+ }
18
+
19
+ // An `aria-` or `data-` attribute written `{undefined}`, as a build leaves one of a feature no call site uses: it is never set.
20
+ export function neverSet(src: string, attribute: { name: string, expression: Span, action: boolean }): boolean {
21
+ return !attribute.action && UNSET_NAME.test(attribute.name) && text(src, attribute.expression) === 'undefined'
22
+ }
@@ -1,20 +1,8 @@
1
1
  import type { Details, ElementNode, Span } from './ast'
2
2
  import type { LintName } from './lints'
3
- import { deprecatedAiLabels } from './deprecated-ai-labels'
4
- import { deprecatedAiLinks } from './deprecated-ai-links'
5
- import { deprecatedAuthSigned } from './deprecated-auth-signed'
6
- import { deprecatedUiCallbacks } from './deprecated-ui-callbacks'
7
- import { deprecatedUiInput } from './deprecated-ui-input'
8
- import { deprecatedUiItems } from './deprecated-ui-items'
9
3
  import { deprecatedUiProps } from './deprecated-ui-props'
10
4
 
11
5
  // The deprecated forms of a kayjs-ui or kayjs-ai component found on an element bound to the library's `file`, each reported under its own lint.
12
6
  export function deprecatedLibrary(element: ElementNode, file: string, text: (span: Span) => string, lint: (span: Span, code: LintName, message: string, details: Details) => void): void {
13
7
  deprecatedUiProps(element, file, text, (span, message, details) => lint(span, 'deprecated-ui-props', message, details))
14
- deprecatedUiCallbacks(element, file, text, (span, message, details) => lint(span, 'deprecated-ui-callbacks', message, details))
15
- deprecatedUiItems(element, file, text, (span, message, details) => lint(span, 'deprecated-ui-items', message, details))
16
- deprecatedUiInput(element, file, text, (span, message, details) => lint(span, 'deprecated-ui-input', message, details))
17
- deprecatedAiLabels(element, file, text, (span, message, details) => lint(span, 'deprecated-ai-labels', message, details))
18
- deprecatedAiLinks(element, file, text, (span, message, details) => lint(span, 'deprecated-ai-links', message, details))
19
- deprecatedAuthSigned(element, file, text, (span, message, details) => lint(span, 'deprecated-auth-signed', message, details))
20
8
  }