@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,44 +0,0 @@
1
- import type { CheckDiagnostic, CheckOptions } from '.'
2
- import { lintLevel } from '../compiler/lints'
3
- import { importedName, walk } from './ast'
4
- import { scan } from './renamed-exports'
5
-
6
- const OLD_ARGUMENTS = /<\s*never\s*,\s*unknown\s*>/
7
-
8
- // `Action<never, unknown>`, the type of an action of any input and output as before 1.105, is `Action` since: both parameters default to it, so the type a prop is given to take any action is the one every action has.
9
- // Found on the `Action` a file imports from `kay`, under whatever local name, in the TypeScript files and the fences of `.kay` files.
10
- export async function actionType(root: string, options: CheckOptions): Promise<CheckDiagnostic[]> {
11
- if (lintLevel('deprecated-action-type', options.lints) === 'allow')
12
- return []
13
-
14
- return scan(root, options, 'deprecated-action-type', OLD_ARGUMENTS, ({ parsed, report }) => {
15
- for (const { ast, base } of parsed) {
16
- const locals = new Set<string>()
17
-
18
- for (const statement of ast.body) {
19
- if (statement.type !== 'ImportDeclaration' || statement.source.value !== 'kay')
20
- continue
21
-
22
- for (const specifier of statement.specifiers) {
23
- if (specifier.type === 'ImportSpecifier' && importedName(specifier) === 'Action')
24
- locals.add(specifier.local.name)
25
- }
26
- }
27
-
28
- if (locals.size === 0)
29
- continue
30
-
31
- walk(ast, (node) => {
32
- if (node.type !== 'TSTypeReference' || node.typeName.type !== 'Identifier' || !locals.has(node.typeName.name) || node.typeArguments === null || node.typeArguments === undefined)
33
- return
34
-
35
- const [input, output, ...rest] = node.typeArguments.params
36
-
37
- if (rest.length > 0 || input?.type !== 'TSNeverKeyword' || output?.type !== 'TSUnknownKeyword')
38
- return
39
-
40
- report(base + node.typeName.start, base + node.end, '`Action<never, unknown>` is `Action` since 1.105, which takes any action as a prop without the two parameters; the old form works until 1.108', 'write `Action`', [{ start: base + node.typeArguments.start, end: base + node.typeArguments.end, text: '' }])
41
- })
42
- }
43
- })
44
- }
@@ -1,56 +0,0 @@
1
- import type { CheckDiagnostic, CheckOptions } from '.'
2
- import type { Node, NodeOfType } from '../compiler/estree'
3
- import { lintLevel } from '../compiler/lints'
4
- import { keyName } from '../compiler/object-literal'
5
- import { renamePackages } from '../package-names'
6
- import { importsOf, walk } from './ast'
7
- import { scan } from './renamed-exports'
8
-
9
- const NEEDLE = /\b(?:transcribe|describeImage)\b/
10
- const FROM_AI = (source: string) => renamePackages(source) === '@kayjs/ai'
11
- const CALLS = ['transcribe', 'describeImage']
12
- const HELP = 'write `locale`, which takes a BCP 47 tag such as `fr` or `pt-BR`'
13
-
14
- type Property = Extract<NodeOfType<'ObjectExpression'>['properties'][number], { type: 'Property' }>
15
-
16
- // `language` in the options of `transcribe()` and `describeImage()`, `locale` since 1.105: every call of kayjs-ai that names a language takes a BCP 47 tag under that name, and `transcribe` turns it into the ISO 639-1 code its provider takes.
17
- // Found on a call of either imported from `@kayjs/ai`, or read off `import * as`, in the options object written in the call; the fix renames the key, a bare `{ language }` becoming `locale: language`, and offers none where `locale` is written too.
18
- export async function aiLanguage(root: string, options: CheckOptions): Promise<CheckDiagnostic[]> {
19
- if (lintLevel('deprecated-ai-language', options.lints) === 'allow')
20
- return []
21
-
22
- return scan(root, options, 'deprecated-ai-language', NEEDLE, ({ parsed, report }) => {
23
- for (const { ast, base } of parsed) {
24
- const found = CALLS.map(name => ({ name, ...importsOf(ast, FROM_AI, name) }))
25
-
26
- if (found.every(({ locals, namespaces }) => locals.size === 0 && namespaces.size === 0))
27
- continue
28
-
29
- const isCall = (callee: Node): boolean => found.some(({ name, locals, namespaces }) => callee.type === 'Identifier'
30
- ? locals.has(callee.name)
31
- : callee.type === 'MemberExpression' && !callee.computed && callee.object.type === 'Identifier' && namespaces.has(callee.object.name) && callee.property.type === 'Identifier' && callee.property.name === name)
32
-
33
- walk(ast, (node) => {
34
- if (node.type !== 'CallExpression' || !isCall(node.callee))
35
- return
36
-
37
- const argument = node.arguments[1]
38
-
39
- if (argument?.type !== 'ObjectExpression')
40
- return
41
-
42
- const properties = argument.properties.filter((property): property is Property => property.type === 'Property')
43
- const language = properties.find(property => !property.computed && keyName(property) === 'language')
44
-
45
- if (!language)
46
- return
47
-
48
- const fixable = !argument.properties.some(property => property.type === 'SpreadElement') && !properties.some(property => keyName(property) === 'locale') && !language.method
49
- const text = language.shorthand ? 'locale: language' : 'locale'
50
- const edit = language.shorthand ? { start: base + language.start, end: base + language.end, text } : { start: base + language.key.start, end: base + language.key.end, text }
51
-
52
- report(base + language.start, base + language.end, '`language` of `transcribe()` and `describeImage()` is `locale` since 1.105, a BCP 47 tag', HELP, fixable ? [edit] : null)
53
- })
54
- }
55
- })
56
- }
@@ -1,90 +0,0 @@
1
- import type { CheckDiagnostic, CheckOptions } from '.'
2
- import type { NodeOfType } from '../compiler/estree'
3
- import type { Property } from './regroup'
4
- import type { Edit } from './renamed-exports'
5
- import { lintLevel } from '../compiler/lints'
6
- import { configObjects, propertiesOf, propertyOf } from './config-objects'
7
- import { scan } from './renamed-exports'
8
-
9
- type ObjectExpression = NodeOfType<'ObjectExpression'>
10
-
11
- const NEEDLE = /\b(?:onStart|observe)\b/
12
- const PUNCTUATION = /^[\s,]*$/
13
-
14
- // Where the property `onError` of `observe` goes: beside it, or in its place when it was the only key.
15
- function movedOnError(root: ObjectExpression, observe: Property, object: ObjectExpression, onError: Property, text: string, base: number): Edit[] | undefined {
16
- if (propertyOf(root, 'onError') !== undefined || object.properties.some(property => property.type !== 'Property'))
17
- return undefined
18
-
19
- const written = text.slice(onError.start, onError.end)
20
-
21
- if (object.properties.length === 1)
22
- return [{ start: base + observe.start, end: base + observe.end, text: written }]
23
-
24
- const at = object.properties.indexOf(onError)
25
- const after = object.properties[at + 1]
26
- const [from, to] = after === undefined ? [object.properties[at - 1]!.end, onError.end] : [onError.start, after.start]
27
- // A comment between the keys would be lost with the property.
28
- const between = after === undefined ? text.slice(from, onError.start) : text.slice(onError.end, to)
29
-
30
- if (!PUNCTUATION.test(between))
31
- return undefined
32
-
33
- return [{ start: base + observe.start, end: base + observe.start, text: `${written}, ` }, { start: base + from, end: base + to, text: '' }]
34
- }
35
-
36
- // `log` of `observe` as a group: `'json'` is `{ format: 'json' }` and a function written in place `{ sink }`.
37
- function groupedLog(log: Property, text: string, base: number): { edits: Edit[], now: string } | undefined {
38
- const { value } = log
39
-
40
- if (value.type === 'Literal' && value.value === 'json')
41
- return { edits: [{ start: base + value.start, end: base + value.end, text: '{ format: \'json\' }' }], now: '{ format: \'json\' }' }
42
-
43
- if (value.type === 'ArrowFunctionExpression' || value.type === 'FunctionExpression')
44
- return { edits: [{ start: base + value.start, end: base + value.end, text: `{ sink: ${text.slice(value.start, value.end)} }` }], now: '{ sink }' }
45
-
46
- return undefined
47
- }
48
-
49
- // The hooks and the log of kay.config.ts, and of the options of `pages()` and `testSite()`, written before 1.105: `onStart` is `onListen`, `observe.onError` is `onError` beside `observe`, and `observe.log` as `'json'` or a function is `{ format: 'json' }` or `{ sink }`.
50
- export async function appHooks(root: string, options: CheckOptions): Promise<CheckDiagnostic[]> {
51
- if (lintLevel('deprecated-app-hooks', options.lints) === 'allow')
52
- return []
53
-
54
- return scan(root, options, 'deprecated-app-hooks', NEEDLE, ({ file, parsed, report }) => {
55
- for (const { ast, base, text } of parsed) {
56
- for (const { object } of configObjects(file, ast)) {
57
- const [start] = propertiesOf(object, 'onStart')
58
-
59
- if (start !== undefined && !start.method && start.kind === 'init') {
60
- const taken = propertyOf(object, 'onListen') !== undefined
61
- const edits: Edit[] = taken ? [] : [start.shorthand ? { start: base + start.start, end: base + start.end, text: 'onListen: onStart' } : { start: base + start.key.start, end: base + start.key.end, text: 'onListen' }]
62
-
63
- report(base + start.start, base + start.end, '`onStart` of the config is deprecated since 1.105: the hook that runs when the server listens is `onListen`, `onStart` naming where a job begins', 'write `onListen`', edits)
64
- }
65
-
66
- const ops = propertyOf(object, 'ops')
67
- const inOps = ops?.value.type === 'ObjectExpression' ? propertyOf(ops.value, 'observe') : undefined
68
-
69
- // The `onError` of an `observe` inside `ops` is reported with no fix: it moves to the top of the config, beside `ops`, which the fix of `observe` does not reach.
70
- for (const [observe, nested] of [[propertyOf(object, 'observe'), false], [inOps, true]] as const) {
71
- const group = observe?.value.type === 'ObjectExpression' ? observe.value : undefined
72
-
73
- if (observe === undefined || group === undefined)
74
- continue
75
-
76
- const [onError] = propertiesOf(group, 'onError')
77
- const [log] = propertiesOf(group, 'log')
78
-
79
- if (onError !== undefined)
80
- report(base + onError.start, base + onError.end, '`observe.onError` is deprecated since 1.105: the hooks are flat keys of the config, named by the moment they run', nested ? 'write `onError` beside `ops`' : 'write `onError` beside `observe`', nested ? null : movedOnError(object, observe, group, onError, text, base) ?? null)
81
-
82
- const grouped = log === undefined || log.shorthand ? undefined : groupedLog(log, text, base)
83
-
84
- if (log !== undefined && grouped !== undefined)
85
- report(base + log.value.start, base + log.value.end, '`observe.log` as `\'json\'` or a function is deprecated since 1.105: it is `{ format, requests, sink }`', `write \`${grouped.now}\``, grouped.edits)
86
- }
87
- }
88
- }
89
- })
90
- }
@@ -1,85 +0,0 @@
1
- import type { CheckDiagnostic, CheckOptions } from '.'
2
- import type { Node, NodeOfType } from '../compiler/estree'
3
- import { lintLevel } from '../compiler/lints'
4
- import { walk } from './ast'
5
- import { scan } from './renamed-exports'
6
-
7
- type Member = NodeOfType<'MemberExpression'>
8
-
9
- const NEEDLE = /[aA]uth\b/
10
- const AUTH_NAME = /^auth$/
11
-
12
- // The methods of a group renamed in 1.105 to the verbs every group shares (`list`, `get`, `create`, `update`, `delete`, `revoke`), by group.
13
- const GROUPED: Record<string, Record<string, string>> = {
14
- organizations: { members: 'listMembers', setMemberRoles: 'updateMemberRoles', removeMember: 'deleteMember', invitations: 'listInvitations', myInvitations: 'listMyInvitations', invitation: 'getInvitation' },
15
- admin: { roles: 'listRoles', auditLog: 'listAuditLog' },
16
- oauthServer: { clients: 'listClients' },
17
- passkeys: { rename: 'update' },
18
- account: { changeUsername: 'updateUsername', profile: 'getProfile', saveProfile: 'updateProfile' },
19
- oauth: { identities: 'listIdentities', providerToken: 'getProviderToken' },
20
- magicLink: { signInWithCode: 'email.signInWithCode' },
21
- }
22
-
23
- // The methods that sat on `auth` itself and went into a group.
24
- const FLAT: Record<string, string> = {
25
- requireAdmin: 'admin.require',
26
- captchaRequired: 'captcha.required',
27
- captchaChallenge: 'captcha.challenge',
28
- provedLately: 'proof.recent',
29
- reprove: 'proof.renew',
30
- hasScope: 'tokens.hasScope',
31
- scopes: 'tokens.scopes',
32
- oauthResource: 'oauthServer.resource',
33
- oauthOrigin: 'oauthServer.origin',
34
- oauthFixed: 'oauthServer.fixed',
35
- }
36
-
37
- // The last name of a receiver, `auth` for `ctx.locals.auth`.
38
- function receiverName(node: Node): string | undefined {
39
- if (node.type === 'Identifier')
40
- return node.name
41
-
42
- return node.type === 'MemberExpression' && !node.computed && node.property.type === 'Identifier' ? node.property.name : undefined
43
- }
44
-
45
- function isPlain(node: Node): node is Member & { property: NodeOfType<'Identifier'> } {
46
- return node.type === 'MemberExpression' && !node.computed && node.property.type === 'Identifier'
47
- }
48
-
49
- // kayjs-auth's methods that moved in 1.105: the verbs of a group (`organizations.members()` is `organizations.listMembers()`, `account.saveProfile()` is `account.updateProfile()`), `magicLink.signInWithCode` into `email`, and the ones on `auth` itself into the group they belong to (`auth.requireAdmin()` is `auth.admin.require()`, `auth.provedLately()` is `auth.proof.recent()`).
50
- // Found on a call whose receiver is named `auth` (`ctx.locals.auth`, `locals.auth`), in the TypeScript files and `.kay` files of the project, as `kay check` reads no types; a template expression is not read. The old names work until 1.108.
51
- export async function authMethods(root: string, options: CheckOptions): Promise<CheckDiagnostic[]> {
52
- if (lintLevel('deprecated-auth-methods', options.lints) === 'allow')
53
- return []
54
-
55
- return scan(root, options, 'deprecated-auth-methods', NEEDLE, ({ parsed, report }) => {
56
- for (const { ast, base } of parsed) {
57
- walk(ast, (node) => {
58
- if (node.type !== 'CallExpression' || !isPlain(node.callee))
59
- return
60
-
61
- const callee = node.callee
62
- const name = callee.property.name
63
- const object = callee.object
64
- let from = callee.property.start
65
- let to: string | undefined
66
-
67
- if (isPlain(object) && Object.hasOwn(GROUPED, object.property.name) && Object.hasOwn(GROUPED[object.property.name]!, name) && AUTH_NAME.test(receiverName(object.object) ?? '')) {
68
- to = GROUPED[object.property.name]![name]!
69
-
70
- // Into another group, the call is written again from the group's name.
71
- if (to.includes('.'))
72
- from = object.property.start
73
- }
74
- else if (Object.hasOwn(FLAT, name) && AUTH_NAME.test(receiverName(object) ?? '')) {
75
- to = FLAT[name]
76
- }
77
-
78
- if (to === undefined)
79
- return
80
-
81
- report(base + callee.property.start, base + callee.property.end, `\`${name}\` of kayjs-auth is \`${to}\` since 1.105`, `write \`${to}\``, [{ start: base + from, end: base + callee.property.end, text: to }])
82
- })
83
- }
84
- })
85
- }
@@ -1,99 +0,0 @@
1
- import type { CheckDiagnostic, CheckOptions } from '.'
2
- import type { Property } from './regroup'
3
- import { lintLevel } from '../compiler/lints'
4
- import { keyName } from '../compiler/object-literal'
5
- import { renamePackages } from '../package-names'
6
- import { importsOf, walk } from './ast'
7
- import { nameOf, regrouped } from './regroup'
8
- import { scan } from './renamed-exports'
9
-
10
- const NEEDLE = /\brateLimit\b/
11
- const FROM_AUTH = (source: string) => renamePackages(source) === '@kayjs/auth'
12
- const CALLS = ['auth', 'authCore']
13
- const HELP = 'group the limit under its feature, `signIn: { ip, account }`'
14
-
15
- // The parts of each feature, the first being what a bare limit on the feature was.
16
- const GROUPS: Record<string, string[]> = {
17
- signIn: ['ip', 'account', 'accountAll'],
18
- resend: ['ip', 'account'],
19
- forgot: ['ip', 'account'],
20
- magicLink: ['ip', 'account'],
21
- emailChange: ['ip', 'account'],
22
- twoFactor: ['ip', 'account'],
23
- emailCode: ['ip', 'account'],
24
- invite: ['sender', 'address'],
25
- oauth: ['register', 'registerAll', 'document', 'token'],
26
- }
27
-
28
- // The flat keys of before 1.105 that are not a feature's first part, and the part they became.
29
- const FLAT: Record<string, [string, string]> = {
30
- signInAccount: ['signIn', 'account'],
31
- signInAccountAll: ['signIn', 'accountAll'],
32
- resendAccount: ['resend', 'account'],
33
- forgotAccount: ['forgot', 'account'],
34
- magicLinkAccount: ['magicLink', 'account'],
35
- emailChangeAccount: ['emailChange', 'account'],
36
- twoFactorAccount: ['twoFactor', 'account'],
37
- emailCodeAccount: ['emailCode', 'account'],
38
- inviteAddress: ['invite', 'address'],
39
- oauthRegister: ['oauth', 'register'],
40
- oauthRegisterAll: ['oauth', 'registerAll'],
41
- oauthDocument: ['oauth', 'document'],
42
- oauthToken: ['oauth', 'token'],
43
- }
44
-
45
- // The limits of kayjs-auth's `rateLimit` as 26 flat keys, grouped by feature since 1.105: `signIn: { ip, account, accountAll }`, `forgot: { ip, account }`, `invite: { sender, address }`, `oauth: { register, registerAll, document, token }`.
46
- // Found in the `rateLimit` object written in a call of `auth` or `authCore` imported from `@kayjs/auth`; the fix, from the first report, rewrites only the keys it moves and offers none where the object spreads, holds a computed or shorthand key, names a part twice or writes a feature both ways.
47
- export async function authRateLimits(root: string, options: CheckOptions): Promise<CheckDiagnostic[]> {
48
- if (lintLevel('deprecated-auth-rate-limits', options.lints) === 'allow')
49
- return []
50
-
51
- return scan(root, options, 'deprecated-auth-rate-limits', NEEDLE, ({ parsed, report }) => {
52
- for (const { ast, base, text } of parsed) {
53
- const found = CALLS.map(name => importsOf(ast, FROM_AUTH, name))
54
-
55
- if (found.every(({ locals, namespaces }) => locals.size === 0 && namespaces.size === 0))
56
- continue
57
-
58
- walk(ast, (node) => {
59
- if (node.type !== 'CallExpression' || !found.some(({ locals, namespaces }) => node.callee.type === 'Identifier' ? locals.has(node.callee.name) : node.callee.type === 'MemberExpression' && node.callee.object.type === 'Identifier' && namespaces.has(node.callee.object.name)))
60
- return
61
-
62
- const first = node.arguments[0]
63
- const argument = first?.type === 'TSAsExpression' || first?.type === 'TSSatisfiesExpression' ? first.expression : first
64
- const limits = argument?.type === 'ObjectExpression' ? argument.properties.find((property): property is Property => property.type === 'Property' && !property.computed && keyName(property) === 'rateLimit') : undefined
65
-
66
- if (limits?.value.type !== 'ObjectExpression')
67
- return
68
-
69
- const old = limits.value.properties.filter((property): property is Property => property.type === 'Property' && !property.computed && isOld(property))
70
-
71
- if (old.length === 0)
72
- return
73
-
74
- const fixed = regrouped(limits.value, text, movedTo)
75
-
76
- for (const [index, property] of old.entries())
77
- report(base + property.start, base + property.end, `\`${nameOf(property)}\` of kayjs-auth's \`rateLimit\` is grouped by feature since 1.105`, HELP, index === 0 && fixed !== undefined ? fixed.map(edit => ({ ...edit, start: base + edit.start, end: base + edit.end })) : null)
78
- })
79
- }
80
- })
81
- }
82
-
83
- // A flat key that is a part of a feature, or a feature written as a bare limit or a list.
84
- function isOld(property: Property): boolean {
85
- const name = nameOf(property)
86
-
87
- if (Object.hasOwn(FLAT, name))
88
- return true
89
-
90
- return Object.hasOwn(GROUPS, name) && (property.value.type === 'ArrayExpression' || (property.value.type === 'ObjectExpression' && property.value.properties.some(inner => inner.type === 'Property' && nameOf(inner) === 'max')))
91
- }
92
-
93
- // Where an old property goes, as its feature and part.
94
- function movedTo(name: string, property: Property): [string, string] | undefined {
95
- if (Object.hasOwn(FLAT, name))
96
- return FLAT[name]
97
-
98
- return isOld(property) ? [name, GROUPS[name]![0]!] : undefined
99
- }
@@ -1,242 +0,0 @@
1
- import type { CheckDiagnostic } from '.'
2
- import type { Span } from '../compiler/ast'
3
- import type { Node, Program } from '../compiler/estree'
4
- import type { LintLevels } from '../compiler/lints'
5
- import type { OldFormLint } from './handler-events'
6
- import { parseProgram } from '../compiler/estree'
7
- import { lintLevels } from '../compiler/lints'
8
- import { offsetAt } from '../compiler/mapping'
9
- import { parseKay } from '../compiler/parser'
10
- import { childrenOf } from './ast'
11
-
12
- // A result narrowed by a read of `ok` is named by its members, `{ ok: true; data: ... }`.
13
- const MISSING = /^Property '[^']+' does not exist on type '(?:CallResult<|\{ ok: (?:true|false); )/
14
- const MODULE = /\.[cm]?tsx?$/
15
- const MISMATCH = /^(?:Type|Argument of type) 'CallResult</
16
- // What a result has of its own: a use of one of these means the code already reads a `CallResult`.
17
- const RESULT_KEYS = new Set(['ok', 'data', 'error', 'errors', 'status', 'message', 'orThrow'])
18
-
19
- // The spans of a `.kay` file's script, server and module fences, or the whole file for a module.
20
- function codeSpans(source: string, kay: boolean): Span[] {
21
- if (!kay)
22
- return [{ start: 0, end: source.length }]
23
-
24
- const file = parseKay(source)
25
-
26
- return [file.script, file.server, file.module].filter(span => span !== undefined)
27
- }
28
-
29
- function parsed(source: string, kay: boolean, at: number): Program | undefined {
30
- const span = codeSpans(source, kay).find(({ start, end }) => at >= start && at <= end)
31
-
32
- return span === undefined ? undefined : parseProgram(source.slice(span.start, span.end), { lang: kay ? 'tsx' : 'ts', recover: true, offset: span.start }).program
33
- }
34
-
35
- interface Walked {
36
- node: Node
37
- parent: Node | undefined
38
- }
39
-
40
- function nodes(program: Program): Walked[] {
41
- const found: Walked[] = []
42
- const visit = (node: Node, parent: Node | undefined): void => {
43
- found.push({ node, parent })
44
-
45
- for (const child of childrenOf(node))
46
- visit(child, node)
47
- }
48
-
49
- visit(program, undefined)
50
-
51
- return found
52
- }
53
-
54
- // The names the program imports, which a call written on one of them is a kay call.
55
- function importedNames(program: Program): Set<string> {
56
- const names = new Set<string>()
57
-
58
- for (const statement of program.body) {
59
- if (statement.type === 'ImportDeclaration') {
60
- for (const specifier of statement.specifiers) {
61
- names.add(specifier.local.name)
62
- }
63
- }
64
- }
65
-
66
- return names
67
- }
68
-
69
- function rootName(callee: Node): string | undefined {
70
- let node = callee
71
-
72
- while (node.type === 'MemberExpression')
73
- node = node.object
74
-
75
- return node.type === 'Identifier' ? node.name : undefined
76
- }
77
-
78
- // The `await` a read of the result is made on: written there, or in a `const` the name was bound by.
79
- function awaitedBy(all: Walked[], subject: Node, at: number): Node | undefined {
80
- if (subject.type === 'AwaitExpression')
81
- return subject
82
-
83
- if (subject.type !== 'Identifier')
84
- return undefined
85
-
86
- const declarations = all.filter(({ node }) => node.type === 'VariableDeclarator' && node.id.type === 'Identifier' && node.id.name === subject.name && node.end <= at).map(({ node }) => node)
87
- const declarator = declarations.at(-1)
88
-
89
- return declarator?.type === 'VariableDeclarator' && declarator.init?.type === 'AwaitExpression' ? declarator.init : undefined
90
- }
91
-
92
- // The nodes that bind a name: a declaration, a parameter, a destructured name or a catch parameter.
93
- function bindingNodes(all: Walked[]): Set<Node> {
94
- const found = new Set<Node>()
95
- const add = (node: Node | null | undefined): void => {
96
- if (node)
97
- found.add(node)
98
- }
99
-
100
- for (const { node } of all) {
101
- const holder = node as unknown as { params?: Node[], param?: Node, left?: Node, argument?: Node, elements?: (Node | null)[], properties?: Node[] }
102
-
103
- if (node.type === 'VariableDeclarator') {
104
- add(node.id)
105
- }
106
- else if (node.type === 'ObjectPattern') {
107
- for (const property of holder.properties ?? [])
108
- add(property.type === 'Property' ? property.value : property)
109
- }
110
- else if (node.type === 'ArrayPattern') {
111
- for (const element of holder.elements ?? [])
112
- add(element)
113
- }
114
- else if (node.type === 'AssignmentPattern') {
115
- add(holder.left)
116
- }
117
- else if (node.type === 'RestElement') {
118
- add(holder.argument)
119
- }
120
- else if (node.type === 'CatchClause') {
121
- add(holder.param)
122
- }
123
- else {
124
- for (const param of holder.params ?? [])
125
- add(param)
126
- }
127
- }
128
-
129
- return found
130
- }
131
-
132
- // Whether the name is bound more than once in the file, so a read of it may be of another binding than the nearest declaration.
133
- function boundTwice(all: Walked[], name: string): boolean {
134
- const bindings = bindingNodes(all)
135
-
136
- return all.filter(({ node }) => node.type === 'Identifier' && node.name === name && bindings.has(node)).length > 1
137
- }
138
-
139
- // Whether the code uses the name the `await` is bound to in any way but reading a field a result has no key of (`list.items`), or the pattern it is destructured by names a result's key: `list.ok`, `list['ok']`, `list[key]`, `const { ok } = list` or `list` handed on, so `.orThrow()` could take away what is read.
140
- function readsResult(all: Walked[], bound: Node | undefined): boolean {
141
- if (bound === undefined)
142
- return false
143
-
144
- if (bound.type === 'Identifier') {
145
- const bindings = bindingNodes(all)
146
-
147
- return all.some(({ node, parent }) => {
148
- if (node.type !== 'Identifier' || node.name !== bound.name || node === bound || bindings.has(node))
149
- return false
150
-
151
- if (parent?.type === 'MemberExpression' && parent.property === node && !parent.computed)
152
- return false
153
-
154
- if (parent?.type === 'Property' && parent.key === node && !parent.computed && !parent.shorthand)
155
- return false
156
-
157
- return !(parent?.type === 'MemberExpression' && parent.object === node && !parent.computed && parent.property.type === 'Identifier' && !RESULT_KEYS.has(parent.property.name))
158
- })
159
- }
160
-
161
- return bound.type === 'ObjectPattern' && bound.properties.some(property => property.type !== 'Property' || property.computed || (property.key.type === 'Identifier' && RESULT_KEYS.has(property.key.name)))
162
- }
163
-
164
- // A read on a call's answer that is no field of a `CallResult`, an island call awaited as data as it was before 1.105: the answer is `{ ok: true, data }` or `{ ok: false, error }` since, so `.orThrow()` after the call gives the data and throws a refusal as it did.
165
- // Fixed where the call is written on a name the file imports and nothing reads `ok`, `data` or `error` of the answer; offered, not applied, otherwise.
166
- export function callResultLint(message: string, source: string, span: Span | undefined, kay: boolean): OldFormLint | undefined {
167
- const missing = MISSING.test(message)
168
-
169
- if (span === undefined || (!missing && !MISMATCH.test(message)))
170
- return undefined
171
-
172
- const program = parsed(source, kay, span.start)
173
-
174
- if (program === undefined)
175
- return undefined
176
-
177
- const all = nodes(program)
178
- let subject: Node | undefined
179
- let bound: Node | undefined
180
-
181
- for (const { node, parent } of all) {
182
- if (missing && node.type === 'MemberExpression' && !node.computed && node.property.start === span.start) {
183
- subject = node.object
184
- bound = node.object
185
- }
186
- else if (missing && node.type === 'Property' && parent?.type === 'ObjectPattern' && node.key.start === span.start) {
187
- const declarator = all.find(({ node: other }) => other.type === 'VariableDeclarator' && other.id === parent)?.node
188
-
189
- subject = declarator?.type === 'VariableDeclarator' ? declarator.init ?? undefined : undefined
190
- bound = parent
191
- }
192
- else if (!missing && (node.type === 'AwaitExpression' || node.type === 'Identifier') && node.start === span.start) {
193
- subject = node
194
- bound = node
195
- }
196
-
197
- if (subject !== undefined)
198
- break
199
- }
200
-
201
- const awaited = subject === undefined ? undefined : awaitedBy(all, subject, span.start)
202
- const call = awaited?.type === 'AwaitExpression' && awaited.argument.type === 'CallExpression' ? awaited.argument : undefined
203
- const report = {
204
- message: 'An island\'s call answers a `CallResult` since 1.105, `{ ok: true, data }` or `{ ok: false, error }`, not its data',
205
- help: 'read `data` after checking `ok`, or write `.orThrow()` after the call: it resolves with the data and throws a refusal as the call did before 1.105',
206
- span,
207
- }
208
-
209
- if (call === undefined)
210
- return report
211
-
212
- const known = importedNames(program)
213
- const name = rootName(call.callee)
214
- const safe = name !== undefined && known.has(name) && !readsResult(all, bound) && !(bound?.type === 'Identifier' && boundTwice(all, bound.name))
215
-
216
- return { ...report, fixes: [{ title: 'Write `.orThrow()` after the call', safe, edits: [{ start: call.end, end: call.end, text: '.orThrow()' }] }] }
217
- }
218
-
219
- // The same for a type error in a module of the project, which has no shadow file: the message tells what it is, and the file is read for the call it names.
220
- export async function moduleCallResult(diagnostic: CheckDiagnostic, levels: LintLevels | undefined): Promise<Pick<CheckDiagnostic, 'code' | 'severity' | 'message' | 'help' | 'fixes'> | undefined> {
221
- if (!(MISSING.test(diagnostic.message) || MISMATCH.test(diagnostic.message)) || !MODULE.test(diagnostic.file))
222
- return undefined
223
-
224
- let source: string
225
-
226
- try {
227
- source = await Bun.file(diagnostic.file).text()
228
- }
229
- catch {
230
- return undefined
231
- }
232
-
233
- const start = offsetAt(source, diagnostic)
234
- const found = callResultLint(diagnostic.message, source, { start, end: start + 1 }, false)
235
-
236
- if (found === undefined)
237
- return undefined
238
-
239
- const level = lintLevels(source, levels)('deprecated-call-result', start)
240
-
241
- return level === 'allow' ? undefined : { code: 'deprecated-call-result', severity: level === 'warn' ? 'warning' : 'error', message: found.message, help: found.help, ...found.fixes && { fixes: found.fixes } }
242
- }
@@ -1,10 +0,0 @@
1
- import type { CheckDiagnostic, CheckOptions } from '.'
2
- import { movedKeys } from './moved-keys'
3
-
4
- const MOVED = new Set(['links', 'offline', 'search'])
5
- const NEEDLE = /\b(?:links|offline|search)\b/
6
-
7
- // The keys `links`, `offline` and `search` of the config, which belong to `client` since 1.105, with the rest of what the browser is given.
8
- export async function clientKeys(root: string, options: CheckOptions): Promise<CheckDiagnostic[]> {
9
- return movedKeys(root, options, { lint: 'deprecated-client-keys', needle: NEEDLE, group: name => MOVED.has(name) ? 'client' : undefined, help: 'write the key in `client`, `client: { links, offline, search }`' })
10
- }