@kayjs/kay 1.106.0 → 1.108.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 (254) hide show
  1. package/README.md +2 -2
  2. package/dist/eslint.js +477 -204
  3. package/editors/zed/extension.toml +2 -2
  4. package/llms/action-protection.md +1 -1
  5. package/llms/actions-from-islands.md +1 -1
  6. package/llms/actions-refused-fields.md +22 -0
  7. package/llms/actions.md +2 -22
  8. package/llms/browser-only.md +1 -1
  9. package/llms/compiler-api.md +1 -1
  10. package/llms/component-libraries.md +1 -1
  11. package/llms/components.md +1 -1
  12. package/llms/deprecated-lints.md +2 -4
  13. package/llms/island-and-form-lints.md +1 -0
  14. package/llms/islands.md +11 -2
  15. package/llms/project-new-and-add.md +1 -1
  16. package/llms/project.md +2 -2
  17. package/llms/schemas.md +6 -4
  18. package/llms/upgrading.md +25 -1
  19. package/llms/whats-new-archive.md +36 -1
  20. package/llms/whats-new.md +18 -35
  21. package/llms.txt +1 -1
  22. package/package.json +15 -6
  23. package/src/build/client.ts +23 -26
  24. package/src/build/entry-files.ts +19 -0
  25. package/src/build/icon-slots.ts +140 -0
  26. package/src/build/lazy-components.ts +130 -0
  27. package/src/build/lazy-manifest.ts +56 -0
  28. package/src/build/lazy-stubs.ts +31 -0
  29. package/src/build/libraries.ts +24 -2
  30. package/src/build/plugin.ts +13 -1
  31. package/src/build/runtime-chunk.ts +3 -3
  32. package/src/build/source-files.ts +8 -3
  33. package/src/build/transform.ts +17 -7
  34. package/src/build/variants.ts +97 -5
  35. package/src/check/action-options.ts +56 -0
  36. package/src/check/project.ts +4 -4
  37. package/src/check/renamed-packages.ts +3 -63
  38. package/src/check/schema-json.ts +226 -0
  39. package/src/check/shadow-types.ts +15 -27
  40. package/src/compiler/codegen.ts +7 -17
  41. package/src/compiler/dead-code.ts +22 -0
  42. package/src/compiler/deprecated-lints-1-105.ts +41 -0
  43. package/src/compiler/deprecated-lints-1-106.ts +1 -1
  44. package/src/compiler/deprecated-lints-1-107.ts +14 -0
  45. package/src/compiler/deprecated-lints.ts +8 -65
  46. package/src/compiler/dom-property.ts +23 -0
  47. package/src/compiler/dom.ts +15 -15
  48. package/src/compiler/import-edits.ts +15 -0
  49. package/src/compiler/index.ts +8 -3
  50. package/src/compiler/island-declaration.ts +15 -0
  51. package/src/compiler/kay-exports.ts +1 -0
  52. package/src/compiler/lazy-imports.ts +357 -0
  53. package/src/compiler/parser.ts +2 -2
  54. package/src/compiler/route-lints.ts +2 -0
  55. package/src/compiler/schema-lints.ts +13 -0
  56. package/src/compiler/script-server.ts +6 -3
  57. package/src/content/validate.ts +1 -1
  58. package/src/new.ts +6 -2
  59. package/src/package-names.ts +1 -1
  60. package/src/runtime/action-call.ts +39 -327
  61. package/src/runtime/action-run.ts +357 -0
  62. package/src/runtime/action.ts +47 -4
  63. package/src/runtime/client.ts +10 -0
  64. package/src/runtime/dom-lazy.ts +276 -0
  65. package/src/runtime/field-errors.ts +58 -0
  66. package/src/runtime/field-refusal.ts +179 -0
  67. package/src/runtime/form.ts +3 -2
  68. package/src/runtime/html.ts +6 -1
  69. package/src/runtime/index.ts +2 -0
  70. package/src/runtime/island.server.ts +36 -2
  71. package/src/runtime/schema-record.ts +2 -1
  72. package/src/runtime/schema.client.ts +104 -14
  73. package/src/runtime/schema.ts +9 -2
  74. package/src/runtime/standard-schema.ts +32 -0
  75. package/src/runtime/validate-run.client.ts +179 -0
  76. package/src/runtime/validate.client.ts +11 -0
  77. package/src/runtime/validate.ts +4 -137
  78. package/src/server/actions.ts +48 -43
  79. package/src/server/answer.ts +102 -0
  80. package/src/server/api-input.ts +166 -0
  81. package/src/server/api.ts +12 -44
  82. package/src/server/app-stages.ts +15 -8
  83. package/src/server/app.ts +5 -2
  84. package/src/server/client.ts +2 -0
  85. package/src/server/dev.ts +7 -9
  86. package/src/server/file-limit.ts +7 -1
  87. package/src/server/forms.ts +1 -1
  88. package/src/server/host-allowlist.ts +7 -7
  89. package/src/server/index.ts +2 -0
  90. package/src/server/kay-routes.ts +221 -0
  91. package/src/server/kay-server.ts +228 -0
  92. package/src/server/kept-exports.ts +1 -0
  93. package/src/server/library.ts +0 -2
  94. package/src/server/mcp.ts +1 -1
  95. package/src/server/openapi.ts +12 -3
  96. package/src/server/phases.ts +249 -0
  97. package/src/server/protection.ts +6 -6
  98. package/src/server/proxy-key.ts +8 -8
  99. package/src/server/query.ts +4 -25
  100. package/src/server/receive.ts +43 -0
  101. package/src/server/render-document.ts +13 -3
  102. package/src/server/request-context.ts +137 -0
  103. package/src/server/schema-check.ts +1 -1
  104. package/src/server/socket.ts +19 -47
  105. package/src/server/stream.ts +1 -1
  106. package/src/server/validate.ts +346 -0
  107. package/src/test/mount.ts +6 -2
  108. package/types/build/client.d.ts +3 -2
  109. package/types/build/client.d.ts.map +1 -1
  110. package/types/build/entry-files.d.ts +4 -0
  111. package/types/build/entry-files.d.ts.map +1 -0
  112. package/types/build/icon-slots.d.ts +7 -0
  113. package/types/build/icon-slots.d.ts.map +1 -0
  114. package/types/build/lazy-components.d.ts +6 -0
  115. package/types/build/lazy-components.d.ts.map +1 -0
  116. package/types/build/lazy-manifest.d.ts +19 -0
  117. package/types/build/lazy-manifest.d.ts.map +1 -0
  118. package/types/build/lazy-stubs.d.ts +5 -0
  119. package/types/build/lazy-stubs.d.ts.map +1 -0
  120. package/types/build/libraries.d.ts +2 -0
  121. package/types/build/libraries.d.ts.map +1 -1
  122. package/types/build/plugin.d.ts +2 -0
  123. package/types/build/plugin.d.ts.map +1 -1
  124. package/types/build/source-files.d.ts.map +1 -1
  125. package/types/build/transform.d.ts +3 -1
  126. package/types/build/transform.d.ts.map +1 -1
  127. package/types/build/variants.d.ts.map +1 -1
  128. package/types/check/action-options.d.ts +3 -0
  129. package/types/check/action-options.d.ts.map +1 -0
  130. package/types/check/renamed-packages.d.ts +0 -3
  131. package/types/check/renamed-packages.d.ts.map +1 -1
  132. package/types/check/schema-json.d.ts +3 -0
  133. package/types/check/schema-json.d.ts.map +1 -0
  134. package/types/check/shadow-types.d.ts.map +1 -1
  135. package/types/compiler/codegen.d.ts +2 -0
  136. package/types/compiler/codegen.d.ts.map +1 -1
  137. package/types/compiler/dead-code.d.ts +9 -0
  138. package/types/compiler/dead-code.d.ts.map +1 -0
  139. package/types/compiler/deprecated-lints-1-105.d.ts +39 -0
  140. package/types/compiler/deprecated-lints-1-105.d.ts.map +1 -0
  141. package/types/compiler/deprecated-lints-1-106.d.ts +1 -1
  142. package/types/compiler/deprecated-lints-1-106.d.ts.map +1 -1
  143. package/types/compiler/deprecated-lints-1-107.d.ts +12 -0
  144. package/types/compiler/deprecated-lints-1-107.d.ts.map +1 -0
  145. package/types/compiler/deprecated-lints.d.ts +36 -53
  146. package/types/compiler/deprecated-lints.d.ts.map +1 -1
  147. package/types/compiler/dom-property.d.ts +9 -0
  148. package/types/compiler/dom-property.d.ts.map +1 -0
  149. package/types/compiler/dom.d.ts +1 -0
  150. package/types/compiler/dom.d.ts.map +1 -1
  151. package/types/compiler/import-edits.d.ts +1 -0
  152. package/types/compiler/import-edits.d.ts.map +1 -1
  153. package/types/compiler/index.d.ts +2 -0
  154. package/types/compiler/index.d.ts.map +1 -1
  155. package/types/compiler/island-declaration.d.ts +5 -0
  156. package/types/compiler/island-declaration.d.ts.map +1 -1
  157. package/types/compiler/kay-exports.d.ts.map +1 -1
  158. package/types/compiler/lazy-imports.d.ts +33 -0
  159. package/types/compiler/lazy-imports.d.ts.map +1 -0
  160. package/types/compiler/lints.d.ts +44 -53
  161. package/types/compiler/lints.d.ts.map +1 -1
  162. package/types/compiler/route-lints.d.ts +8 -0
  163. package/types/compiler/route-lints.d.ts.map +1 -1
  164. package/types/compiler/schema-lints.d.ts +11 -0
  165. package/types/compiler/schema-lints.d.ts.map +1 -0
  166. package/types/compiler/script-server.d.ts.map +1 -1
  167. package/types/new.d.ts +1 -0
  168. package/types/new.d.ts.map +1 -1
  169. package/types/runtime/action-call.d.ts.map +1 -1
  170. package/types/runtime/action-run.d.ts +23 -0
  171. package/types/runtime/action-run.d.ts.map +1 -0
  172. package/types/runtime/action.d.ts +26 -1
  173. package/types/runtime/action.d.ts.map +1 -1
  174. package/types/runtime/client.d.ts.map +1 -1
  175. package/types/runtime/dom-lazy.d.ts +6 -0
  176. package/types/runtime/dom-lazy.d.ts.map +1 -0
  177. package/types/runtime/field-errors.d.ts +4 -0
  178. package/types/runtime/field-errors.d.ts.map +1 -0
  179. package/types/runtime/field-refusal.d.ts +37 -0
  180. package/types/runtime/field-refusal.d.ts.map +1 -0
  181. package/types/runtime/form.d.ts +1 -1
  182. package/types/runtime/form.d.ts.map +1 -1
  183. package/types/runtime/html.d.ts.map +1 -1
  184. package/types/runtime/index.d.ts +2 -0
  185. package/types/runtime/index.d.ts.map +1 -1
  186. package/types/runtime/island.server.d.ts +2 -0
  187. package/types/runtime/island.server.d.ts.map +1 -1
  188. package/types/runtime/schema-record.d.ts.map +1 -1
  189. package/types/runtime/schema.client.d.ts.map +1 -1
  190. package/types/runtime/schema.d.ts +6 -1
  191. package/types/runtime/schema.d.ts.map +1 -1
  192. package/types/runtime/standard-schema.d.ts +37 -0
  193. package/types/runtime/standard-schema.d.ts.map +1 -0
  194. package/types/runtime/validate-run.client.d.ts +4 -0
  195. package/types/runtime/validate-run.client.d.ts.map +1 -0
  196. package/types/runtime/validate.client.d.ts +4 -0
  197. package/types/runtime/validate.client.d.ts.map +1 -0
  198. package/types/runtime/validate.d.ts +1 -21
  199. package/types/runtime/validate.d.ts.map +1 -1
  200. package/types/server/actions.d.ts.map +1 -1
  201. package/types/server/answer.d.ts +6 -0
  202. package/types/server/answer.d.ts.map +1 -0
  203. package/types/server/api-input.d.ts +19 -0
  204. package/types/server/api-input.d.ts.map +1 -0
  205. package/types/server/api.d.ts.map +1 -1
  206. package/types/server/app-stages.d.ts +4 -1
  207. package/types/server/app-stages.d.ts.map +1 -1
  208. package/types/server/app.d.ts +2 -0
  209. package/types/server/app.d.ts.map +1 -1
  210. package/types/server/client.d.ts +1 -0
  211. package/types/server/client.d.ts.map +1 -1
  212. package/types/server/dev.d.ts +1 -1
  213. package/types/server/dev.d.ts.map +1 -1
  214. package/types/server/file-limit.d.ts.map +1 -1
  215. package/types/server/host-allowlist.d.ts +3 -3
  216. package/types/server/host-allowlist.d.ts.map +1 -1
  217. package/types/server/index.d.ts +2 -0
  218. package/types/server/index.d.ts.map +1 -1
  219. package/types/server/kay-routes.d.ts +47 -0
  220. package/types/server/kay-routes.d.ts.map +1 -0
  221. package/types/server/kay-server.d.ts +25 -0
  222. package/types/server/kay-server.d.ts.map +1 -0
  223. package/types/server/kept-exports.d.ts.map +1 -1
  224. package/types/server/library.d.ts +0 -1
  225. package/types/server/library.d.ts.map +1 -1
  226. package/types/server/openapi.d.ts.map +1 -1
  227. package/types/server/phases.d.ts +36 -0
  228. package/types/server/phases.d.ts.map +1 -0
  229. package/types/server/protection.d.ts +3 -2
  230. package/types/server/protection.d.ts.map +1 -1
  231. package/types/server/proxy-key.d.ts +3 -3
  232. package/types/server/proxy-key.d.ts.map +1 -1
  233. package/types/server/query.d.ts.map +1 -1
  234. package/types/server/receive.d.ts +9 -0
  235. package/types/server/receive.d.ts.map +1 -0
  236. package/types/server/render-document.d.ts.map +1 -1
  237. package/types/server/request-context.d.ts +29 -0
  238. package/types/server/request-context.d.ts.map +1 -0
  239. package/types/server/schema-check.d.ts +1 -0
  240. package/types/server/schema-check.d.ts.map +1 -1
  241. package/types/server/socket.d.ts +3 -5
  242. package/types/server/socket.d.ts.map +1 -1
  243. package/types/server/validate.d.ts +26 -0
  244. package/types/server/validate.d.ts.map +1 -0
  245. package/types/test/mount.d.ts.map +1 -1
  246. package/src/check/schema-type.ts +0 -9
  247. package/src/compiler/deprecated-script-fence.ts +0 -26
  248. package/src/server/field-errors.ts +0 -136
  249. package/types/check/schema-type.d.ts +0 -3
  250. package/types/check/schema-type.d.ts.map +0 -1
  251. package/types/compiler/deprecated-script-fence.d.ts +0 -3
  252. package/types/compiler/deprecated-script-fence.d.ts.map +0 -1
  253. package/types/server/field-errors.d.ts +0 -6
  254. package/types/server/field-errors.d.ts.map +0 -1
package/dist/eslint.js CHANGED
@@ -25,7 +25,7 @@ var __esm = (fn, res, err) => () => {
25
25
  };
26
26
 
27
27
  // package.json
28
- var version = "1.106.0", peerDependencies;
28
+ var version = "1.108.0", peerDependencies;
29
29
  var init_package = __esm(() => {
30
30
  peerDependencies = {
31
31
  "@happy-dom/global-registrator": "^20.14.6 || ^21.0.3",
@@ -1027,6 +1027,18 @@ function rolesOf(source, script, fence) {
1027
1027
  return { island, client: undefined, pin: undefined };
1028
1028
  return island.render === "client" ? { island, client: island.span, pin: undefined } : { island, client: undefined, pin: { kind: island.render, ...island.span } };
1029
1029
  }
1030
+ function spelledOutFirstFence(source, line, word) {
1031
+ if (!line || word?.word !== "script" || source.slice(0, line.start).trim() !== "")
1032
+ return [];
1033
+ return [{
1034
+ start: line.start,
1035
+ end: word.end,
1036
+ code: "fence-invalid",
1037
+ message: "`--- script` cannot open a file: the script is written `---`",
1038
+ help: "`--- script` is only for a script that follows a `--- server`, `--- module` or `--- style` fence",
1039
+ fixes: [{ title: "Write `---`", safe: true, edits: [{ start: line.start + 3, end: word.end, text: "" }] }]
1040
+ }];
1041
+ }
1030
1042
  var ISLAND_CALL, RENDERS, HYDRATE_TIMINGS, KEYS;
1031
1043
  var init_island_declaration = __esm(() => {
1032
1044
  init_estree();
@@ -1227,7 +1239,7 @@ function parseKay(source) {
1227
1239
  const template = parser.parseTemplate();
1228
1240
  if (bareClosing)
1229
1241
  explainSecondFence(source, bareClosing, diagnostics);
1230
- return { source, script: fences.script, server: fences.server, serverFence, module: fences.module, style: fences.style, typeParameters, client, pin, island, scriptLine, templateStart, template, diagnostics, unclosedServer };
1242
+ return { source, script: fences.script, server: fences.server, serverFence, module: fences.module, style: fences.style, typeParameters, client, pin, island, scriptLine, templateStart, template, diagnostics: [...diagnostics, ...spelledOutFirstFence(source, scriptLine, fenceWord)], unclosedServer };
1231
1243
  }
1232
1244
  function explainSecondFence(source, closing, diagnostics) {
1233
1245
  const stray = diagnostics.find((diagnostic) => diagnostic.code === undefined && diagnostic.start >= closing.end && BARE_LINE.test(source.slice(diagnostic.start, diagnostic.end)) && source[diagnostic.start - 1] === `
@@ -3993,11 +4005,20 @@ function importEdits(file, fence, imports, wanted) {
3993
4005
  }
3994
4006
  return edits;
3995
4007
  }
3996
- var STARTS_WITH_IMPORT, STARTS_BLANK, PROLOGUE_LINE;
4008
+ function withoutComma(src, specifier, declaration) {
4009
+ const after = COMMA_AFTER.exec(src.slice(specifier.end, declaration.end));
4010
+ if (after)
4011
+ return { start: specifier.start, end: specifier.end + after[0].length };
4012
+ const before = COMMA_BEFORE.exec(src.slice(declaration.start, specifier.start));
4013
+ return { start: specifier.start - (before?.[0].length ?? 0), end: specifier.end };
4014
+ }
4015
+ var STARTS_WITH_IMPORT, STARTS_BLANK, PROLOGUE_LINE, COMMA_AFTER, COMMA_BEFORE;
3997
4016
  var init_import_edits = __esm(() => {
3998
4017
  STARTS_WITH_IMPORT = /^\s*import\b/;
3999
4018
  STARTS_BLANK = /^[ \t]*\r?\n/;
4000
4019
  PROLOGUE_LINE = /^(?:#!.*|\/\/\/\s*<reference\b.*|[ \t]*(['"])use [\w -]+\1[ \t]*(?:;[ \t]*)?)(?:\r?\n|$)/;
4020
+ COMMA_AFTER = /^\s*,\s*/;
4021
+ COMMA_BEFORE = /,\s*$/;
4001
4022
  });
4002
4023
 
4003
4024
  // src/compiler/names.ts
@@ -4583,6 +4604,7 @@ var init_kay_exports = __esm(() => {
4583
4604
  trustHtml: "shared",
4584
4605
  uid: "shared",
4585
4606
  untrack: "browser",
4607
+ validate: "shared",
4586
4608
  watch: "browser",
4587
4609
  webPush: "browser",
4588
4610
  withBase: "shared",
@@ -5375,9 +5397,12 @@ function readsItself(ast, declaration) {
5375
5397
  return found;
5376
5398
  }
5377
5399
  function toolOptions(args) {
5378
- const options = args[0]?.type === "ArrowFunctionExpression" || args[0]?.type === "FunctionExpression" ? args[1] : args[2];
5400
+ const isHandler = (arg) => arg?.type === "ArrowFunctionExpression" || arg?.type === "FunctionExpression";
5401
+ const optionsFirst = args[0]?.type === "ObjectExpression" && isHandler(args[1]);
5402
+ const afterHandler = isHandler(args[0]) ? args[1] : args[2];
5403
+ const options = optionsFirst ? args[0] : afterHandler;
5379
5404
  let unreadable = options !== undefined && options.type !== "ObjectExpression";
5380
- for (const arg of args.slice(1)) {
5405
+ for (const arg of args.slice(options === args[0] ? 0 : 1)) {
5381
5406
  if (arg.type !== "ObjectExpression")
5382
5407
  continue;
5383
5408
  const keys = new Map(arg.properties.flatMap((property) => isPlainProperty(property) && !property.computed ? [[keyName(property.key), property.value]] : []));
@@ -5999,6 +6024,24 @@ var init_outside = __esm(() => {
5999
6024
  OUTSIDE_TARGET = ` target="_blank" ${NEW_TAB_ATTRIBUTE}`;
6000
6025
  });
6001
6026
 
6027
+ // src/compiler/dead-code.ts
6028
+ function text(src, span) {
6029
+ return src.slice(span.start, span.end).trim();
6030
+ }
6031
+ function neverTaken(src, branch) {
6032
+ return branch.alias === undefined && text(src, branch.test) === "false";
6033
+ }
6034
+ function neverShown(src, node) {
6035
+ return node.fallback === undefined && node.branches.every((branch) => neverTaken(src, branch));
6036
+ }
6037
+ function neverSet(src, attribute) {
6038
+ return !attribute.action && UNSET_NAME.test(attribute.name) && text(src, attribute.expression) === "undefined";
6039
+ }
6040
+ var UNSET_NAME;
6041
+ var init_dead_code = __esm(() => {
6042
+ UNSET_NAME = /^(?:aria|data)-/;
6043
+ });
6044
+
6002
6045
  // src/runtime/class-table.ts
6003
6046
  function resolveClasses(text, table = globalThis[TABLE]) {
6004
6047
  if (table === undefined)
@@ -7273,7 +7316,7 @@ class AttributeFixes {
7273
7316
  if (this.src[start - 1] === ",") {
7274
7317
  start--;
7275
7318
  } else {
7276
- const after = COMMA_AFTER.exec(this.src.slice(end));
7319
+ const after = COMMA_AFTER2.exec(this.src.slice(end));
7277
7320
  if (after)
7278
7321
  end += after[0].length;
7279
7322
  }
@@ -7301,13 +7344,13 @@ class AttributeFixes {
7301
7344
  return this.src.slice(span.start, span.end);
7302
7345
  }
7303
7346
  }
7304
- var PART = "[A-Z][\\w-]*", PART_NAME, PART_NAME_LIST, FIELD_NAME2, WHITESPACE_CHAR, COMMA_AFTER, PLAIN_TEXT, QUOTED;
7347
+ var PART = "[A-Z][\\w-]*", PART_NAME, PART_NAME_LIST, FIELD_NAME2, WHITESPACE_CHAR, COMMA_AFTER2, PLAIN_TEXT, QUOTED;
7305
7348
  var init_validate_fixes = __esm(() => {
7306
7349
  PART_NAME = new RegExp(`^${PART}$`, "i");
7307
7350
  PART_NAME_LIST = new RegExp(`^${PART}(?: ${PART})*$`, "i");
7308
7351
  FIELD_NAME2 = /^[\w.[\]-]+$/;
7309
7352
  WHITESPACE_CHAR = /\s/;
7310
- COMMA_AFTER = /^\s*,\s*/;
7353
+ COMMA_AFTER2 = /^\s*,\s*/;
7311
7354
  PLAIN_TEXT = /^[^"'`\\&\n{}<>]*$/;
7312
7355
  QUOTED = /^\s*(['"`])([^'"`\\${}\n]*)\1\s*$/;
7313
7356
  });
@@ -8649,6 +8692,25 @@ var init_dom_here = __esm(() => {
8649
8692
  CALLED = /[a-z_$][\w$]*(?=\s*\()/gi;
8650
8693
  });
8651
8694
 
8695
+ // src/compiler/dom-property.ts
8696
+ function propertyBindings(b, src, attribute, link, node) {
8697
+ if (neverSet(src, attribute))
8698
+ return [];
8699
+ return [(variable) => {
8700
+ b.add(`KayEffect(() => KayProperty(${variable(node)}, ${JSON.stringify(attribute.name)}, `);
8701
+ if (attribute.action)
8702
+ b.add("KayFormAction((").addSource(attribute.expression).add("))");
8703
+ else if (attribute.name === "href" && link.leaving)
8704
+ b.add(`KayOutside(${variable(node)}, (`).addSource(attribute.expression).add(`)${link.rel ? ", true" : ""})`);
8705
+ else
8706
+ b.add("(").addSource(attribute.expression).add(")");
8707
+ b.add(`${link.written && attribute.name === "href" ? ", true" : ""}));`);
8708
+ }];
8709
+ }
8710
+ var init_dom_property = __esm(() => {
8711
+ init_dead_code();
8712
+ });
8713
+
8652
8714
  // src/compiler/style-arguments.ts
8653
8715
  function addStyleArguments(b, attribute) {
8654
8716
  if (attribute.expression)
@@ -8696,8 +8758,10 @@ var DomTemplate;
8696
8758
  var init_dom = __esm(() => {
8697
8759
  init_outside();
8698
8760
  init_ast();
8761
+ init_dead_code();
8699
8762
  init_dom_fields();
8700
8763
  init_dom_here();
8764
+ init_dom_property();
8701
8765
  init_event_modifiers();
8702
8766
  init_expression();
8703
8767
  init_items();
@@ -8766,6 +8830,8 @@ var init_dom = __esm(() => {
8766
8830
  b.add(`KayAppend(${parent}, `);
8767
8831
  this.element(item.node);
8768
8832
  b.add("); ");
8833
+ } else if (item.kind === "if" && neverShown(this.src, item.node)) {
8834
+ b.add(`KayMarkers(${parent}); `);
8769
8835
  } else {
8770
8836
  b.add(`{ const [KayS, KayE] = KayMarkers(${parent}); `);
8771
8837
  this.dynamic(item, "null", "KayS", "KayE");
@@ -8774,6 +8840,10 @@ var init_dom = __esm(() => {
8774
8840
  }
8775
8841
  b.add(`${"} ".repeat(blocks)}})`);
8776
8842
  }
8843
+ slot(item, element, start, end) {
8844
+ if (item.kind !== "if" || !neverShown(this.src, item.node))
8845
+ this.dynamic(item, element, start, end);
8846
+ }
8777
8847
  dynamic(item, element, start, end) {
8778
8848
  const { b } = this;
8779
8849
  const at = `${element}, ${start}, ${end}`;
@@ -8849,7 +8919,7 @@ var init_dom = __esm(() => {
8849
8919
  if(node, at) {
8850
8920
  const { b } = this;
8851
8921
  b.add(`${node.branches.some((branch) => branch.alias) ? "KayBranches" : "KayChoose"}(${at}, [`);
8852
- for (const branch of node.branches) {
8922
+ for (const branch of node.branches.filter((each) => !neverTaken(this.src, each))) {
8853
8923
  b.wrap(branch, () => {
8854
8924
  b.add("[() => (").addSource(branch.test).add("), (");
8855
8925
  if (branch.alias)
@@ -9084,16 +9154,7 @@ var init_dom = __esm(() => {
9084
9154
  break;
9085
9155
  case "value":
9086
9156
  this.notesLink(link, attribute.name);
9087
- own.push((variable) => {
9088
- b.add(`KayEffect(() => KayProperty(${variable(node)}, ${JSON.stringify(attribute.name)}, `);
9089
- if (attribute.action)
9090
- b.add("KayFormAction((").addSource(attribute.expression).add("))");
9091
- else if (attribute.name === "href" && link.leaving)
9092
- b.add(`KayOutside(${variable(node)}, (`).addSource(attribute.expression).add(`)${link.rel ? ", true" : ""})`);
9093
- else
9094
- b.add("(").addSource(attribute.expression).add(")");
9095
- b.add(`${link.written && attribute.name === "href" ? ", true" : ""}));`);
9096
- });
9157
+ own.push(...propertyBindings(b, this.src, attribute, link, node));
9097
9158
  break;
9098
9159
  }
9099
9160
  }
@@ -9141,12 +9202,12 @@ var init_dom = __esm(() => {
9141
9202
  } else if (item.kind === "element") {
9142
9203
  html += this.templateOf(item.node, this.child(node, "element"), bindings);
9143
9204
  } else if (sole) {
9144
- bindings.push((variable) => this.dynamic(item, variable(node), "null", "null"));
9205
+ bindings.push((variable) => this.slot(item, variable(node), "null", "null"));
9145
9206
  } else {
9146
9207
  const start = this.child(node, "start");
9147
9208
  const end = this.child(node, "end");
9148
9209
  html += START_MARKER + END_MARKER;
9149
- bindings.push((variable) => this.dynamic(item, "null", variable(start), variable(end)));
9210
+ bindings.push((variable) => this.slot(item, "null", variable(start), variable(end)));
9150
9211
  }
9151
9212
  }
9152
9213
  if (blocks > 0) {
@@ -11211,6 +11272,233 @@ var init_jsx = __esm(() => {
11211
11272
  PLAIN_PARAMETER = /^[\p{ID_Start}$_][\p{ID_Continue}$\u200C\u200D]*$/u;
11212
11273
  });
11213
11274
 
11275
+ // src/compiler/lazy-imports.ts
11276
+ function occurrences(text, name) {
11277
+ return text.match(new RegExp(`(?<![\\w$.])${name.replaceAll("$", "\\$")}(?![\\w$])`, "g"))?.length ?? 0;
11278
+ }
11279
+
11280
+ class Positions {
11281
+ source;
11282
+ deferring;
11283
+ visit;
11284
+ repeating = 0;
11285
+ constructor(source, deferring, visit) {
11286
+ this.source = source;
11287
+ this.deferring = deferring;
11288
+ this.visit = visit;
11289
+ }
11290
+ exhaustive(branches, deferred) {
11291
+ const real = this.visit;
11292
+ const calls = branches.map((children) => {
11293
+ const seen = [];
11294
+ this.visit = {
11295
+ use: (element, inner) => seen.push({ name: element.name, element, deferred: inner, outlet: false }),
11296
+ outlet: (element, inner) => seen.push({ name: element.outlet ? this.source.slice(element.outlet.name.start, element.outlet.name.end) : CHILDREN, element, deferred: inner, outlet: true })
11297
+ };
11298
+ this.walk(children, deferred);
11299
+ return seen;
11300
+ });
11301
+ this.visit = real;
11302
+ const keyOf = (call) => `${call.outlet}:${call.name}`;
11303
+ const everywhere = calls.map((seen) => new Set(seen.map(keyOf)));
11304
+ for (const call of calls.flat()) {
11305
+ const always = everywhere.every((names) => names.has(keyOf(call)));
11306
+ if (call.outlet)
11307
+ real.outlet?.(call.element, call.deferred || !always && this.repeating === 0);
11308
+ else
11309
+ real.use?.(call.element, call.deferred || !always && this.repeating === 0);
11310
+ }
11311
+ }
11312
+ walk(nodes, deferred) {
11313
+ for (const node of nodes) {
11314
+ switch (node.kind) {
11315
+ case "element":
11316
+ this.element(node, deferred);
11317
+ break;
11318
+ case "if":
11319
+ if (node.fallback) {
11320
+ this.exhaustive([...node.branches.map((branch) => branch.children), node.fallback.children], deferred);
11321
+ break;
11322
+ }
11323
+ for (const branch of node.branches)
11324
+ this.walk(branch.children, deferred || this.repeating === 0);
11325
+ break;
11326
+ case "match":
11327
+ if (node.fallback) {
11328
+ this.exhaustive([...node.cases.map((branch) => branch.children), node.fallback.children], deferred);
11329
+ break;
11330
+ }
11331
+ for (const branch of node.cases)
11332
+ this.walk(branch.children, deferred || this.repeating === 0);
11333
+ break;
11334
+ case "for":
11335
+ this.repeating++;
11336
+ this.walk(node.children, deferred);
11337
+ this.repeating--;
11338
+ this.walk(node.fallback ?? [], deferred);
11339
+ break;
11340
+ case "await":
11341
+ this.walk(node.pending, deferred);
11342
+ this.walk(node.resolved?.children ?? [], deferred);
11343
+ this.walk(node.rejected?.children ?? [], true);
11344
+ break;
11345
+ case "try":
11346
+ this.walk(node.children, deferred);
11347
+ this.walk(node.rejected?.children ?? [], true);
11348
+ break;
11349
+ case "text":
11350
+ this.walk(node.parts.filter((part) => part.kind === "element"), deferred);
11351
+ break;
11352
+ case "slot":
11353
+ case "snippet":
11354
+ case "pending":
11355
+ this.walk(node.children, deferred);
11356
+ break;
11357
+ case "const":
11358
+ case "error":
11359
+ break;
11360
+ }
11361
+ }
11362
+ }
11363
+ element(element, deferred) {
11364
+ if (element.component)
11365
+ this.visit.use?.(element, deferred);
11366
+ else if (element.name === "slot")
11367
+ this.visit.outlet?.(element, deferred);
11368
+ const props = element.component ? this.deferring(element) : [];
11369
+ for (const child of element.children) {
11370
+ const own = child.kind === "slot" ? this.source.slice(child.name.start, child.name.end) : CHILDREN;
11371
+ const repeated = child.kind === "slot" && child.params !== undefined;
11372
+ this.repeating += repeated ? 1 : 0;
11373
+ this.walk(child.kind === "slot" ? child.children : [child], deferred || props.includes(own));
11374
+ this.repeating -= repeated ? 1 : 0;
11375
+ }
11376
+ }
11377
+ }
11378
+ function codeOf2(file) {
11379
+ const blanks = [];
11380
+ visitNodes(file.template, (node) => {
11381
+ if (node.kind === "text")
11382
+ blanks.push(...node.parts.filter((part) => part.kind === "chunk"));
11383
+ else if (node.kind === "element")
11384
+ blanks.push(...node.attributes.flatMap((attribute) => attribute.kind === "static" ? [attribute.value] : []));
11385
+ });
11386
+ let code = file.source;
11387
+ for (const { start, end } of blanks)
11388
+ code = `${code.slice(0, start)}${" ".repeat(end - start)}${code.slice(end)}`;
11389
+ return blankLiterals(code);
11390
+ }
11391
+ function blankLiterals(code) {
11392
+ const blank = (text) => " ".repeat(text.length);
11393
+ return code.split(`
11394
+ `).map((line) => {
11395
+ if (LINE_COMMENT.test(line))
11396
+ return blank(line);
11397
+ return UNSURE_LINE.test(line) ? line : line.replace(PLAIN_STRING, blank);
11398
+ }).join(`
11399
+ `);
11400
+ }
11401
+ function lazyImports(file, imports, known) {
11402
+ const found = positionsLazy(file, imports, known);
11403
+ for (let changed = found.size > 0;changed; ) {
11404
+ const held = new Set(eagerReach(imports, known, found));
11405
+ changed = false;
11406
+ for (const [local, lazy] of found) {
11407
+ if (held.has(lazy.key)) {
11408
+ found.delete(local);
11409
+ changed = true;
11410
+ }
11411
+ }
11412
+ }
11413
+ return found;
11414
+ }
11415
+ function eagerReach(imports, known, lazy) {
11416
+ const reach = new Set;
11417
+ for (const binding of imports) {
11418
+ const component = binding.imported === "default" && !binding.typeOnly ? known[binding.source] : undefined;
11419
+ if (component && !lazy.has(binding.local)) {
11420
+ reach.add(component.key);
11421
+ for (const key of component.reach)
11422
+ reach.add(key);
11423
+ }
11424
+ }
11425
+ return [...reach];
11426
+ }
11427
+ function positionsLazy(file, imports, known) {
11428
+ const candidates = new Map;
11429
+ const specifiers = new Map;
11430
+ for (const binding of imports) {
11431
+ if (binding.imported !== "default" || binding.typeOnly)
11432
+ continue;
11433
+ specifiers.set(binding.local, binding.source);
11434
+ const declared = file.source.slice(binding.declaration.start, binding.declaration.end);
11435
+ if ((known[binding.source]?.size ?? 0) >= LAZY_FLOOR && PLAIN_IMPORT.test(declared))
11436
+ candidates.set(binding.local, { binding, uses: [] });
11437
+ }
11438
+ if (candidates.size === 0)
11439
+ return new Map;
11440
+ const refused = new Set;
11441
+ new Positions(file.source, (element) => {
11442
+ const specifier = specifiers.get(element.name);
11443
+ return specifier === undefined ? [] : known[specifier]?.deferred ?? [];
11444
+ }, {
11445
+ use(element, deferred) {
11446
+ const candidate = candidates.get(element.name);
11447
+ if (!candidate)
11448
+ return;
11449
+ candidate.uses.push(deferred);
11450
+ if (serverIslandOf(element, file.source) !== undefined)
11451
+ refused.add(element.name);
11452
+ }
11453
+ }).walk(file.template, false);
11454
+ const code = codeOf2(file);
11455
+ const found = new Map;
11456
+ for (const [local, { binding, uses }] of candidates) {
11457
+ const written = occurrences(code, local) - 1;
11458
+ if (uses.length === 0 || !uses.every(Boolean) || refused.has(local) || written !== uses.length)
11459
+ continue;
11460
+ found.set(local, { key: known[binding.source].key, specifier: binding.source, declaration: binding.declaration });
11461
+ }
11462
+ return found;
11463
+ }
11464
+ function lazyImportsOf(file, imports, options, hydrated, routeFile, clientOnly) {
11465
+ return options.components !== undefined && !(routeFile || clientOnly) && (options.output === "dom" || hydrated) ? lazyImports(file, imports, options.components) : undefined;
11466
+ }
11467
+ function lazyNoteImport(lazy, mode) {
11468
+ return mode === "html" && (lazy?.size ?? 0) > 0 ? `import { lazyNote as ${helperName("lazyNote")} } from 'kay/island'
11469
+ ` : "";
11470
+ }
11471
+ function lazyDomImport(lazy) {
11472
+ return (lazy?.size ?? 0) > 0 ? `import { lazy as ${helperName("lazy")}, ready as ${helperName("ready")} } from 'kay/dom-lazy'
11473
+ ` : "";
11474
+ }
11475
+ function lazyEdits(imports, span, lazy, mode, moduleId) {
11476
+ if (mode !== "dom" && mode !== "html")
11477
+ return [];
11478
+ const last = Math.max(-1, ...[...lazy?.values() ?? []].map((other) => other.declaration.start));
11479
+ return imports.flatMap((binding) => {
11480
+ const found = lazy?.get(binding.local);
11481
+ if (!found || binding.declaration.start < span.start || binding.declaration.end > span.end)
11482
+ return [];
11483
+ const key = JSON.stringify(found.key);
11484
+ const specifier = JSON.stringify(found.specifier);
11485
+ const eager = `${helperName("lazy")}_${binding.local}`;
11486
+ const ready = found.declaration.start === last ? `
11487
+ ${helperName("ready")}(${JSON.stringify(moduleId)}, ${JSON.stringify([...lazy?.values() ?? []].map((other) => other.key))})` : "";
11488
+ return [{ ...found.declaration, text: mode === "dom" ? `const ${binding.local} = ${helperName("lazy")}(${key}, () => import(${specifier}))${ready}` : `import ${eager} from ${specifier}
11489
+ const ${binding.local} = ${helperName("lazyNote")}(${key}, () => ${eager})` }];
11490
+ });
11491
+ }
11492
+ var LAZY_FLOOR = 2000, CHILDREN = "children", LINE_COMMENT, PLAIN_STRING, UNSURE_LINE, PLAIN_IMPORT;
11493
+ var init_lazy_imports = __esm(() => {
11494
+ init_ast();
11495
+ init_markup();
11496
+ LINE_COMMENT = /^[ \t]*\/\/.*$/;
11497
+ PLAIN_STRING = /'(?:[^'\\\n$`]|\\.)*'|"(?:[^"\\\n$`]|\\.)*"/g;
11498
+ UNSURE_LINE = /`|[(,=:?!&|{;[]\s*\/(?![/*])/;
11499
+ PLAIN_IMPORT = /^import\s+[\w$]+\s+from\s*(['"])[^'"]+\1\s*;?$/;
11500
+ });
11501
+
11214
11502
  // src/compiler/template-reads.ts
11215
11503
  function binders(node) {
11216
11504
  switch (node.kind) {
@@ -11862,12 +12150,12 @@ ${this.mode === "dom" && this.facts.ambientForm ? `const KayHere = ${helperName(
11862
12150
  }
11863
12151
  b.add(this.slotTypes().imports);
11864
12152
  if (mode === "html")
11865
- b.add(htmlHelperImport(this.options.awaitAlert, facts.await));
12153
+ b.add(htmlHelperImport(this.options.awaitAlert, facts.await) + lazyNoteImport(this.options.lazy, mode));
11866
12154
  if (this.loadPlan)
11867
12155
  b.add(`import { loadScope as ${helperName("loadScope")} } from 'kay/html'
11868
12156
  `);
11869
12157
  if (mode === "dom")
11870
- b.add(domHelperImport(this.options.awaitAlert, facts.await));
12158
+ b.add(domHelperImport(this.options.awaitAlert, facts.await) + lazyDomImport(this.options.lazy));
11871
12159
  if (mode === "dom" && this.kind === "island" && titled)
11872
12160
  b.add(`import { pageTitle as ${helperName("pageTitle")} } from 'kay/internal/title'
11873
12161
  `);
@@ -12106,7 +12394,7 @@ export default KayIsland(${JSON.stringify(this.options.island)}, ${name}${this.g
12106
12394
  const left = duplicates.filter(inside);
12107
12395
  if (left.length > 0 && left.length === imports.filter(inside).length)
12108
12396
  return;
12109
- const edits = left.map((binding) => this.withoutComma(binding.span, binding.declaration));
12397
+ const edits = [...left.map((binding) => withoutComma(this.src, binding.span, binding.declaration)), ...lazyEdits(imports, span, this.options.lazy, this.mode, this.options.moduleId)];
12110
12398
  for (const specifier of specifiers) {
12111
12399
  const quoted = this.src.slice(specifier.start, specifier.end);
12112
12400
  const target = specifier.start >= span.start && specifier.end <= span.end ? this.options.relocateImport?.(quoted.length > 1 && quoted.endsWith(quoted[0]) ? quoted.slice(1, -1) : quoted.slice(1)) : undefined;
@@ -12131,13 +12419,6 @@ export default KayIsland(${JSON.stringify(this.options.island)}, ${name}${this.g
12131
12419
  return start === 0 || this.src[start - 1] === `
12132
12420
  ` ? start : offset;
12133
12421
  }
12134
- withoutComma(specifier, declaration) {
12135
- const after = IMPORT_COMMA_AFTER.exec(this.src.slice(specifier.end, declaration.end));
12136
- if (after)
12137
- return { start: specifier.start, end: specifier.end + after[0].length };
12138
- const before = IMPORT_COMMA_BEFORE.exec(this.src.slice(declaration.start, specifier.start));
12139
- return { start: specifier.start - (before?.[0].length ?? 0), end: specifier.end };
12140
- }
12141
12422
  emitLoad(server) {
12142
12423
  const { b } = this;
12143
12424
  const query = this.declaresQuery();
@@ -12406,17 +12687,19 @@ function deferredData(facts, server) {
12406
12687
  function paramsType(options) {
12407
12688
  return options.params ? `{ ${options.params.map((name) => `${JSON.stringify(name)}: ${options.paramTypes?.[name] ?? "string"}`).join(", ")} }` : "Record<string, string>";
12408
12689
  }
12409
- var HORIZONTAL_SPACE, WRITE_NAMES, CTX_REFERENCE, IDENTIFIER6, IMPORT_COMMA_AFTER, IMPORT_COMMA_BEFORE, BROKEN_SPECIFIER, PRERENDER = "prerender", QUERY2 = "query", NOT_ACTIONS;
12690
+ var HORIZONTAL_SPACE, WRITE_NAMES, CTX_REFERENCE, IDENTIFIER6, BROKEN_SPECIFIER, PRERENDER = "prerender", QUERY2 = "query", NOT_ACTIONS;
12410
12691
  var init_codegen = __esm(() => {
12411
12692
  init_action();
12412
12693
  init_ast();
12413
12694
  init_dom();
12414
12695
  init_head_shorthand();
12415
12696
  init_html();
12697
+ init_import_edits();
12416
12698
  init_inspect();
12417
12699
  init_island_arguments();
12418
12700
  init_items();
12419
12701
  init_jsx();
12702
+ init_lazy_imports();
12420
12703
  init_load_plan();
12421
12704
  init_mapping();
12422
12705
  init_markup();
@@ -12433,8 +12716,6 @@ var init_codegen = __esm(() => {
12433
12716
  WRITE_NAMES = { to: "writeTo", update: "updateTo", back: "writeBack", updateBack: "updateBack" };
12434
12717
  CTX_REFERENCE = /\bctx\b/;
12435
12718
  IDENTIFIER6 = /[\p{ID_Start}$_][\p{ID_Continue}$]*/gu;
12436
- IMPORT_COMMA_AFTER = /^\s*,\s*/;
12437
- IMPORT_COMMA_BEFORE = /,\s*$/;
12438
12719
  BROKEN_SPECIFIER = /^((?:\s*(?:\/\/.*\n|\/\*(?:[^*]|\*(?!\/))*\*\/))*\s*import\b(?:[^'"]*[^\w$'"]from)?\s*)((['"])[^'";\s]*\3?)/;
12439
12720
  NOT_ACTIONS = new Set([PAGE, ...PAGE_SETTINGS]);
12440
12721
  });
@@ -12676,29 +12957,6 @@ var init_deprecated_parts = __esm(() => {
12676
12957
  init_old_parts();
12677
12958
  });
12678
12959
 
12679
- // src/compiler/deprecated-script-fence.ts
12680
- function spelledOutScriptFence(file) {
12681
- const line = file.scriptLine;
12682
- if (!line || file.source.slice(0, line.start).trim() !== "")
12683
- return [];
12684
- const spelled = SPELLED_OUT.exec(file.source.slice(line.start, line.end));
12685
- if (!spelled)
12686
- return [];
12687
- return [{
12688
- start: line.start,
12689
- end: line.start + spelled[0].length,
12690
- code: "deprecated-script-fence",
12691
- checkOnly: true,
12692
- message: "`--- script` is `---` spelled out, deprecated since 1.102",
12693
- help: "write `---`: the word is only needed for a script that follows a `--- server`, `--- module` or `--- style` fence",
12694
- fixes: [{ title: "Write `---`", safe: true, edits: [{ start: line.start + 3, end: line.start + spelled[0].length, text: "" }] }]
12695
- }];
12696
- }
12697
- var SPELLED_OUT;
12698
- var init_deprecated_script_fence = __esm(() => {
12699
- SPELLED_OUT = /^---[ \t]+script\b/;
12700
- });
12701
-
12702
12960
  // src/runtime/form-types.ts
12703
12961
  function autocompleteByName(name) {
12704
12962
  return NAMED_AUTOCOMPLETE.get(name.replace(NAME_SEPARATORS, "").toLowerCase());
@@ -13822,6 +14080,99 @@ export async function members(auth: Auth, org: string) {
13822
14080
  };
13823
14081
  });
13824
14082
 
14083
+ // src/compiler/deprecated-lints-1-105.ts
14084
+ var SOURCE_READERS;
14085
+ var init_deprecated_lints_1_105 = __esm(() => {
14086
+ SOURCE_READERS = {
14087
+ "deprecated-source-readers": {
14088
+ level: "warn",
14089
+ group: "deprecated",
14090
+ since: "1.105",
14091
+ site: true,
14092
+ summary: "The readers and hooks of an island's sources before 1.105, which every source reads alike since: `data()` in place of `value()` (a `resource`), `last()` (a `stream` or `socket`) and `rows()` (a `local` collection), `onData` in place of `onSuccess` (a `track()` handle) and `onSync` (a collection), whose event hands `value` where they handed `data` and `rows`, an action's `data()` and `status()` in place of `succeeded()`, and a collection's `sync.queued()` and `sync.status()` in place of `unsynced()` and `syncStatus()`. The old names work until 1.108. Found in the TypeScript files and `.kay` files of the project, templates included, on a name bound once to a call of `resource`, `stream`, `socket` or `local` from `kay` or to a `.track()` call, as `kay check` reads no types: a source reached through a property, a prop or another file is not found; `succeeded()` is found on any receiver. The fix renames the member, and the `data` or `rows` of a hook's inline handler to `value`; `succeeded()?.data` becomes `data()` and `succeeded() !== undefined` becomes `status() === 'ready'`. A `succeeded()` read in any other way, a handler that is no inline function and a shorthand hook are reported with no fix.",
14093
+ wrong: `---
14094
+ import { local, resource } from 'kay'
14095
+ import notesApi from '../api/notes'
14096
+ import { save } from './notes'
14097
+
14098
+ const list = resource(notesApi, '/')
14099
+ const notes = local({ key: 'id', read: () => [], put: save })
14100
+ ---
14101
+ p {list.value()?.length} on the server, {notes.rows().length} here, {notes.unsynced()} waiting`,
14102
+ right: `---
14103
+ import { local, resource } from 'kay'
14104
+ import notesApi from '../api/notes'
14105
+ import { save } from './notes'
14106
+
14107
+ const list = resource(notesApi, '/')
14108
+ const notes = local({ key: 'id', read: () => [], put: save })
14109
+ ---
14110
+ p {list.data()?.length} on the server, {notes.data().length} here, {notes.sync.queued()} waiting`
14111
+ },
14112
+ "deprecated-live-api": {
14113
+ level: "warn",
14114
+ group: "deprecated",
14115
+ since: "1.105",
14116
+ site: true,
14117
+ summary: "The forms of `set` and `presence` before 1.105, which write every live value and every room alike since: `set(next, { key })` of a value per key and `set(next, { user })` of a value per user in place of `set(key, next)` and `set(user, next)`, and `presence({ room, member })` in place of `presence(room, member)`. The old forms work until 1.108. Found in the TypeScript files and `.kay` files of the project, on a name bound once to a `live()` call from `kay`, or imported under the name of a declaration every file of the project agrees on (a value per key is one declared with a function of the key or `key: true`, per user with `user: true`), as `kay check` reads no types: a value reached through a namespace import or a property is not found. `presence` is the one imported from `kay`. The fix reorders the arguments of `set`, and writes the arguments of `presence` as one object, its options object spread into it; a `presence` given options that are no object written there is reported with no fix.",
14118
+ wrong: `// src/live.ts
14119
+ import { live } from 'kay'
14120
+
14121
+ export const room = live((id: string) => ({ id, users: 0 }))
14122
+
14123
+ room.set('lobby', { id: 'lobby', users: 3 })`,
14124
+ right: `// src/live.ts
14125
+ import { live } from 'kay'
14126
+
14127
+ export const room = live((id: string) => ({ id, users: 0 }))
14128
+
14129
+ room.set({ id: 'lobby', users: 3 }, { key: 'lobby' })`
14130
+ },
14131
+ "deprecated-action-type": {
14132
+ level: "warn",
14133
+ group: "deprecated",
14134
+ since: "1.105",
14135
+ site: true,
14136
+ summary: "`Action<never, unknown>` before 1.105, the type a prop takes to accept any action: `Action` since, whose two parameters default to it. `Action<{ name: string }, string>` keeps its input and output types, and a `.with()` action crosses into an island as any other does. The old form works until 1.108. Found on the `Action` a file imports from `kay`, under any local name, in the TypeScript files and the fences of `.kay` files. The fix drops the type arguments.",
14137
+ wrong: `---
14138
+ import type { Action } from 'kay'
14139
+
14140
+ const { run } = props<{ run: Action<never, unknown> }>()
14141
+ ---
14142
+ form(action={run})
14143
+ button Go`,
14144
+ right: `---
14145
+ import type { Action } from 'kay'
14146
+
14147
+ const { run } = props<{ run: Action }>()
14148
+ ---
14149
+ form(action={run})
14150
+ button Go`
14151
+ },
14152
+ "deprecated-action-readers": {
14153
+ level: "warn",
14154
+ group: "deprecated",
14155
+ since: "1.105",
14156
+ site: true,
14157
+ summary: "An action's `failed()`, `error(field)` and `validate(form, field)` before 1.105, which a form shows and now reads from `form`: `form.failed()`, `form.error(field)` and `form.validate(form, field)`, the call state (`pending()`, `status()`, `data()`) staying on the action. The old names work until 1.108. Found in the TypeScript files and `.kay` files of the project, templates included, on a name bound once to a call of `action` from `kay`, to the `.with()` of one, or imported in lowercase from a `.kay` file, as `kay check` reads no types: an action reached through a property or a prop is not found. The fix writes `form.` before the name.",
14158
+ wrong: `---
14159
+ import { add } from './notes.kay'
14160
+ ---
14161
+ form(action={add})
14162
+ input(name="title" aria-invalid={add.error('title') ? 'true' : undefined})
14163
+ if add.failed()
14164
+ p Not saved`,
14165
+ right: `---
14166
+ import { add } from './notes.kay'
14167
+ ---
14168
+ form(action={add})
14169
+ input(name="title" aria-invalid={add.form.error('title') ? 'true' : undefined})
14170
+ if add.form.failed()
14171
+ p Not saved`
14172
+ }
14173
+ };
14174
+ });
14175
+
13825
14176
  // src/compiler/deprecated-lints-1-106.ts
13826
14177
  var SCHEMA_BUILDERS;
13827
14178
  var init_deprecated_lints_1_106 = __esm(() => {
@@ -13831,7 +14182,7 @@ var init_deprecated_lints_1_106 = __esm(() => {
13831
14182
  group: "deprecated",
13832
14183
  since: "1.106",
13833
14184
  site: true,
13834
- summary: "The PascalCase builders of `s` before 1.106, which kay's own lowercase builders replace, each taking the same field options (`optional`, `default`, `error`, `label`, `description`, `example`) and short names for the rest: `s.String` is `s.string` (`min`, `max`), `s.Integer` `s.int`, `s.Number` and `s.Numeric` `s.number`, `s.Boolean` and `s.BooleanString` `s.boolean`, `s.Array` `s.list`, `s.UnionEnum` and `s.UnionKeys` `s.enum`, and `s.Date`, `s.Literal`, `s.Union`, `s.Object`, `s.File`, `s.Files`, `s.Secret` and `s.Public` their lowercase names; `s.Optional(field)` is `optional: true` in the options of the field; an `s.Object({ ... })` that is the schema of an `action` or a `defineEnv` is the record of fields alone; and a file size written `'2m'` is `'2mb'`. The old names work until 2.0. Found on the `s` a file imports from `kay`, in the TypeScript files and the fences of `.kay` files. The fix renames the builder and the options that changed; an `s.Optional` around anything but one of these builders, such as a helper of `kay/content`, is left as it is. A lowercase `s.object` refuses a key its shape lacks where kay reads the schema itself (collection frontmatter, `defineEnv`), where `s.Object` let it by: write `{ extra: 'strip' }` where the old way is wanted. A query, the headers and the cookies of a request carry keys no schema names, so their unknown keys are dropped whatever the schema says.",
14185
+ summary: "The PascalCase builders of `s` before 1.106, which kay's own lowercase builders replace, each taking the same field options (`optional`, `default`, `error`, `label`, `description`, `example`) and short names for the rest: `s.String` is `s.string` (`min`, `max`), `s.Integer` `s.int`, `s.Number` and `s.Numeric` `s.number`, `s.Boolean` and `s.BooleanString` `s.boolean`, `s.Array` `s.list`, `s.UnionEnum` and `s.UnionKeys` `s.enum`, and `s.Date`, `s.Literal`, `s.Union`, `s.Object`, `s.File`, `s.Files`, `s.Secret` and `s.Public` their lowercase names; `s.Optional(field)` is `optional: true` in the options of the field; an `s.Object({ ... })` that is the schema of an `action` or a `defineEnv` is the record of fields alone; and a file size written `'2m'` is `'2mb'`. The old names work until 2.0. Found on the `s` a file imports from `kay`, in the TypeScript files and the fences of `.kay` files. The fix renames the builder and the options that changed; an `s.Optional` around anything but one of these builders, such as a helper of `kay/content`, is left as it is. A lowercase `s.object` refuses a key its shape lacks where kay reads the schema itself (an action's input, an API route's body, `defineEnv`, collection frontmatter), where `s.Object` let it by: write `{ extra: 'strip' }` where the old way is wanted. A query, the headers and the cookies of a request carry keys no schema names, so their unknown keys are dropped whatever the schema says.",
13835
14186
  wrong: `--- server
13836
14187
  import { action, s } from 'kay'
13837
14188
 
@@ -13848,6 +14199,32 @@ p x`
13848
14199
  };
13849
14200
  });
13850
14201
 
14202
+ // src/compiler/deprecated-lints-1-107.ts
14203
+ var ACTION_OPTIONS;
14204
+ var init_deprecated_lints_1_107 = __esm(() => {
14205
+ ACTION_OPTIONS = {
14206
+ "deprecated-action-options": {
14207
+ level: "warn",
14208
+ group: "deprecated",
14209
+ since: "1.107",
14210
+ site: true,
14211
+ summary: "The arguments of `action` before 1.107, `action(schema, handler, options)` and `action(handler, options)`: the options come first, with the input in them, as an API route's do, `action({ input: schema, ...options }, handler)` and `action(options, handler)`. `input` is a plain record of fields or any schema. The old forms work until 2.0. Found on the `action` a file imports from `kay`, in the TypeScript files and the fences of `.kay` files; the fix moves the arguments and keeps their text.",
14212
+ wrong: `--- server
14213
+ import { action, s } from 'kay'
14214
+
14215
+ export const add = action({ title: s.string() }, ({ title }) => title, { maxSize: '1mb' })
14216
+ ---
14217
+ p x`,
14218
+ right: `--- server
14219
+ import { action, s } from 'kay'
14220
+
14221
+ export const add = action({ input: { title: s.string() }, maxSize: '1mb' }, ({ title }) => title)
14222
+ ---
14223
+ p x`
14224
+ }
14225
+ };
14226
+ });
14227
+
13851
14228
  // src/compiler/deprecated-typed-lints.ts
13852
14229
  var TYPED_DEPRECATIONS;
13853
14230
  var init_deprecated_typed_lints = __esm(() => {
@@ -13923,96 +14300,14 @@ p {names()}`
13923
14300
  var DEPRECATED_LINTS;
13924
14301
  var init_deprecated_lints = __esm(() => {
13925
14302
  init_deprecated_auth_lints();
14303
+ init_deprecated_lints_1_105();
13926
14304
  init_deprecated_lints_1_106();
14305
+ init_deprecated_lints_1_107();
13927
14306
  init_deprecated_typed_lints();
13928
14307
  DEPRECATED_LINTS = {
13929
14308
  ...SCHEMA_BUILDERS,
13930
- "deprecated-source-readers": {
13931
- level: "warn",
13932
- group: "deprecated",
13933
- since: "1.105",
13934
- site: true,
13935
- summary: "The readers and hooks of an island's sources before 1.105, which every source reads alike since: `data()` in place of `value()` (a `resource`), `last()` (a `stream` or `socket`) and `rows()` (a `local` collection), `onData` in place of `onSuccess` (a `track()` handle) and `onSync` (a collection), whose event hands `value` where they handed `data` and `rows`, an action's `data()` and `status()` in place of `succeeded()`, and a collection's `sync.queued()` and `sync.status()` in place of `unsynced()` and `syncStatus()`. The old names work until 1.108. Found in the TypeScript files and `.kay` files of the project, templates included, on a name bound once to a call of `resource`, `stream`, `socket` or `local` from `kay` or to a `.track()` call, as `kay check` reads no types: a source reached through a property, a prop or another file is not found; `succeeded()` is found on any receiver. The fix renames the member, and the `data` or `rows` of a hook's inline handler to `value`; `succeeded()?.data` becomes `data()` and `succeeded() !== undefined` becomes `status() === 'ready'`. A `succeeded()` read in any other way, a handler that is no inline function and a shorthand hook are reported with no fix.",
13936
- wrong: `---
13937
- import { local, resource } from 'kay'
13938
- import notesApi from '../api/notes'
13939
- import { save } from './notes'
13940
-
13941
- const list = resource(notesApi, '/')
13942
- const notes = local({ key: 'id', read: () => [], put: save })
13943
- ---
13944
- p {list.value()?.length} on the server, {notes.rows().length} here, {notes.unsynced()} waiting`,
13945
- right: `---
13946
- import { local, resource } from 'kay'
13947
- import notesApi from '../api/notes'
13948
- import { save } from './notes'
13949
-
13950
- const list = resource(notesApi, '/')
13951
- const notes = local({ key: 'id', read: () => [], put: save })
13952
- ---
13953
- p {list.data()?.length} on the server, {notes.data().length} here, {notes.sync.queued()} waiting`
13954
- },
13955
- "deprecated-live-api": {
13956
- level: "warn",
13957
- group: "deprecated",
13958
- since: "1.105",
13959
- site: true,
13960
- summary: "The forms of `set` and `presence` before 1.105, which write every live value and every room alike since: `set(next, { key })` of a value per key and `set(next, { user })` of a value per user in place of `set(key, next)` and `set(user, next)`, and `presence({ room, member })` in place of `presence(room, member)`. The old forms work until 1.108. Found in the TypeScript files and `.kay` files of the project, on a name bound once to a `live()` call from `kay`, or imported under the name of a declaration every file of the project agrees on (a value per key is one declared with a function of the key or `key: true`, per user with `user: true`), as `kay check` reads no types: a value reached through a namespace import or a property is not found. `presence` is the one imported from `kay`. The fix reorders the arguments of `set`, and writes the arguments of `presence` as one object, its options object spread into it; a `presence` given options that are no object written there is reported with no fix.",
13961
- wrong: `// src/live.ts
13962
- import { live } from 'kay'
13963
-
13964
- export const room = live((id: string) => ({ id, users: 0 }))
13965
-
13966
- room.set('lobby', { id: 'lobby', users: 3 })`,
13967
- right: `// src/live.ts
13968
- import { live } from 'kay'
13969
-
13970
- export const room = live((id: string) => ({ id, users: 0 }))
13971
-
13972
- room.set({ id: 'lobby', users: 3 }, { key: 'lobby' })`
13973
- },
13974
- "deprecated-action-type": {
13975
- level: "warn",
13976
- group: "deprecated",
13977
- since: "1.105",
13978
- site: true,
13979
- summary: "`Action<never, unknown>` before 1.105, the type a prop takes to accept any action: `Action` since, whose two parameters default to it. `Action<{ name: string }, string>` keeps its input and output types, and a `.with()` action crosses into an island as any other does. The old form works until 1.108. Found on the `Action` a file imports from `kay`, under any local name, in the TypeScript files and the fences of `.kay` files. The fix drops the type arguments.",
13980
- wrong: `---
13981
- import type { Action } from 'kay'
13982
-
13983
- const { run } = props<{ run: Action<never, unknown> }>()
13984
- ---
13985
- form(action={run})
13986
- button Go`,
13987
- right: `---
13988
- import type { Action } from 'kay'
13989
-
13990
- const { run } = props<{ run: Action }>()
13991
- ---
13992
- form(action={run})
13993
- button Go`
13994
- },
13995
- "deprecated-action-readers": {
13996
- level: "warn",
13997
- group: "deprecated",
13998
- since: "1.105",
13999
- site: true,
14000
- summary: "An action's `failed()`, `error(field)` and `validate(form, field)` before 1.105, which a form shows and now reads from `form`: `form.failed()`, `form.error(field)` and `form.validate(form, field)`, the call state (`pending()`, `status()`, `data()`) staying on the action. The old names work until 1.108. Found in the TypeScript files and `.kay` files of the project, templates included, on a name bound once to a call of `action` from `kay`, to the `.with()` of one, or imported in lowercase from a `.kay` file, as `kay check` reads no types: an action reached through a property or a prop is not found. The fix writes `form.` before the name.",
14001
- wrong: `---
14002
- import { add } from './notes.kay'
14003
- ---
14004
- form(action={add})
14005
- input(name="title" aria-invalid={add.error('title') ? 'true' : undefined})
14006
- if add.failed()
14007
- p Not saved`,
14008
- right: `---
14009
- import { add } from './notes.kay'
14010
- ---
14011
- form(action={add})
14012
- input(name="title" aria-invalid={add.form.error('title') ? 'true' : undefined})
14013
- if add.form.failed()
14014
- p Not saved`
14015
- },
14309
+ ...ACTION_OPTIONS,
14310
+ ...SOURCE_READERS,
14016
14311
  "deprecated-ui-props": {
14017
14312
  level: "warn",
14018
14313
  group: "deprecated",
@@ -14051,58 +14346,6 @@ Card(class={{ head: 'p-6' }})`,
14051
14346
  import Card from './card.kay'
14052
14347
  ---
14053
14348
  Card(parts={{ head: 'p-6' }})`
14054
- },
14055
- "deprecated-script-fence": {
14056
- level: "warn",
14057
- group: "deprecated",
14058
- since: "1.102",
14059
- summary: "`--- script` as the first fence of a file, `---` since 1.102: the bare line opens the component script wherever no named fence comes before it, so one fence had two spellings. `--- script` stays for a script that follows a `--- server`, `--- module` or `--- style` fence, where a bare `---` would close that fence instead, and `--- client` still replaces `---` rather than modifying it. The old form still works. The fix drops the word, keeping the type parameters of `--- script <T>` as `--- <T>`.",
14060
- wrong: `--- script
14061
- const { title } = props<{ title: string }>()
14062
- ---
14063
- h1 {title}`,
14064
- right: `---
14065
- const { title } = props<{ title: string }>()
14066
- ---
14067
- h1 {title}`
14068
- },
14069
- "deprecated-schema-type": {
14070
- level: "warn",
14071
- group: "deprecated",
14072
- since: "1.103",
14073
- site: true,
14074
- summary: "`TSchema` imported from `kay/library`, `Schema` since 1.103: kay's own name for what `s` builds and every schema option takes, so a signature of the app does not name TypeBox, whose type follows the Elysia kay is built on. The old name works until 1.106. Found on an import from `kay/library` in the TypeScript files and `.kay` files of the project. The fix renames the import and each use of it; a file that already has a `Schema` of its own is reported with no fix, and one that imports it aliased with only the import renamed.",
14075
- wrong: `---
14076
- import type { TSchema } from 'kay/library'
14077
-
14078
- export function check<Fields extends TSchema>(fields: Fields) {
14079
- return fields
14080
- }
14081
- ---
14082
- p x`,
14083
- right: `---
14084
- import type { Schema } from 'kay/library'
14085
-
14086
- export function check<Fields extends Schema>(fields: Fields) {
14087
- return fields
14088
- }
14089
- ---
14090
- p x`
14091
- },
14092
- "deprecated-package-names": {
14093
- level: "warn",
14094
- group: "deprecated",
14095
- since: "1.104",
14096
- site: true,
14097
- summary: "A package of kay under the `@kaynooo` scope, `@kayjs` since 1.104: `@kaynooo/kayjs` is `@kayjs/kay`, and `@kaynooo/kayjs-ui`, `-auth`, `-mail`, `-cms` and `-ai` are `@kayjs/ui`, `@kayjs/auth`, `@kayjs/mail`, `@kayjs/cms` and `@kayjs/ai`. The old names stop at 1.103, which stays installable, so an app on them installs and checks as before until it moves; this lint goes in 1.107. Found where a name is an `import` or `export ... from` specifier, a `require()`, `import()` or `mock.module()` argument or a config key (a quoted name keyed to anything but a package name or a version, as `librarySettings`) of the project's TypeScript and `.kay` files, in the `@import` and `@plugin` paths of its CSS, and in its package.json and tsconfig files; a name in a comment or any other string, as data a tool reads or a table of renames, is left alone. The fix writes the new name; a package.json that lists the new name already is reported with a fix that is not safe, and `kay upgrade` does the whole move, package.json and install included.",
14098
- wrong: `---
14099
- import Button from '@kaynooo/kayjs-ui/button.kay'
14100
- ---
14101
- Button Save`,
14102
- right: `---
14103
- import Button from '@kayjs/ui/button.kay'
14104
- ---
14105
- Button Save`
14106
14349
  },
14107
14350
  "deprecated-test-helpers": {
14108
14351
  level: "warn",
@@ -15202,6 +15445,32 @@ for row, i of rows() key={i}
15202
15445
  };
15203
15446
  });
15204
15447
 
15448
+ // src/compiler/schema-lints.ts
15449
+ var SCHEMA_LINTS;
15450
+ var init_schema_lints = __esm(() => {
15451
+ SCHEMA_LINTS = {
15452
+ "schema-without-json-schema": {
15453
+ level: "warn",
15454
+ group: "forms",
15455
+ site: true,
15456
+ summary: "A Standard Schema validator with no `~standard.jsonSchema` where an action's `input` or an API route's `body`, `query`, `params`, `headers` or `cookie` takes a schema: it still validates, but a form shows no constraints, a form or a query is not read as numbers and booleans, and OpenAPI and MCP show an open schema. Read from the source, in `.ts` modules and `.kay` fences: a hand-written object with `~standard` and no `jsonSchema`, and what valibot builds (valibot carries none until `toStandardJsonSchema` from `@valibot/to-json-schema` wraps it), followed through a `const` and a relative import. Zod 4.2+ and ArkType 2.1.28+ carry it.",
15457
+ wrong: `--- server
15458
+ import { action } from 'kay'
15459
+ import * as v from 'valibot'
15460
+
15461
+ export const add = action({ input: v.object({ title: v.string() }) }, ({ title }) => title)
15462
+ ---
15463
+ p x`,
15464
+ right: `--- server
15465
+ import { action, s } from 'kay'
15466
+
15467
+ export const add = action({ input: { title: s.string({ max: 200 }) } }, ({ title }) => title)
15468
+ ---
15469
+ p x`
15470
+ }
15471
+ };
15472
+ });
15473
+
15205
15474
  // src/compiler/serial-awaits.ts
15206
15475
  function stepOf(statement) {
15207
15476
  if (statement.type !== "VariableDeclaration" || statement.kind !== "const" || statement.declarations.length !== 1)
@@ -15303,11 +15572,13 @@ var ROUTE_LINTS;
15303
15572
  var init_route_lints = __esm(() => {
15304
15573
  init_link_flags();
15305
15574
  init_loop_lints();
15575
+ init_schema_lints();
15306
15576
  init_serial_awaits();
15307
15577
  ROUTE_LINTS = {
15308
15578
  ...SERIAL_AWAITS_LINTS,
15309
15579
  ...LOOP_LINTS,
15310
15580
  ...LINK_LINTS,
15581
+ ...SCHEMA_LINTS,
15311
15582
  "text-size-colour": {
15312
15583
  level: "warn",
15313
15584
  group: "code",
@@ -19338,9 +19609,11 @@ function compileKay(original, filename, options = {}) {
19338
19609
  const hydratableServer = options.output === "html" && options.hydratable === true;
19339
19610
  const twin = hydratableServer && !options.twinBuild && island === undefined && !routeFile ? `./${basename5(filename)}${ISLAND_TWIN}` : undefined;
19340
19611
  const pin = file.pin;
19612
+ const hydrated = hydratableServer && (island !== undefined || options.twinBuild === true);
19613
+ const lazy = lazyImportsOf(file, script.imports, options, hydrated, routeFile, client);
19341
19614
  const rawCause = island === undefined ? undefined : islandCause(file, script) ?? browserCause(file, script, live);
19342
19615
  const cause = withInteractive(realCause(rawCause, expansion, original), script);
19343
- const generateOptions = { cause: options.inspect === true && cause !== undefined ? describeCause(cause) : undefined, classTable: options.classTable, classMerge: options.classMerge, awaitAlert: options.awaitAlert, island, client, lives: island === undefined ? undefined : liveBindings(script, options.importedSignals).map((binding) => binding.local), twin, writtenProps: options.writtenProps, output: options.output, failedCode, hydratable: hydratableServer && (island !== undefined || options.twinBuild === true), moduleId: islandId(filename, options.root), includeServer: options.includeServer, params: options.params, paramTypes: options.paramTypes, outerQueries: options.outerQueries, outerGuards: options.outerGuards, outerSlots: options.outerSlots, layoutFile: basename5(filename) === LAYOUT, component: options.page === false && !routeFile, check: options.check, route: options.check === true && pageFile, pageFile, namedRefresh: options.namedRefresh, insideIsland: options.insideIsland, inspect: options.inspect, inspectSource: expansion ? { text: original, real: (offset) => expansion.real(offset) } : undefined, relocateImport: options.relocateImport, contextModule: options.check === true ? options.contextModule : undefined, ui: options.output === undefined ? undefined : options.ui, uiAdded: options.output === undefined ? options.ui : undefined, errorPage: isErrorPage(basename5(filename)), cardPage: basename5(filename) === CARD_PAGE, special: basename5(filename).startsWith("_") && basename5(filename) !== LAYOUT };
19616
+ const generateOptions = { cause: options.inspect === true && cause !== undefined ? describeCause(cause) : undefined, classTable: options.classTable, classMerge: options.classMerge, awaitAlert: options.awaitAlert, island, client, lives: island === undefined ? undefined : liveBindings(script, options.importedSignals).map((binding) => binding.local), twin, writtenProps: options.writtenProps, output: options.output, failedCode, hydratable: hydrated, moduleId: islandId(filename, options.root), includeServer: options.includeServer, params: options.params, paramTypes: options.paramTypes, outerQueries: options.outerQueries, outerGuards: options.outerGuards, outerSlots: options.outerSlots, layoutFile: basename5(filename) === LAYOUT, component: options.page === false && !routeFile, check: options.check, route: options.check === true && pageFile, pageFile, namedRefresh: options.namedRefresh, insideIsland: options.insideIsland, inspect: options.inspect, inspectSource: expansion ? { text: original, real: (offset) => expansion.real(offset) } : undefined, relocateImport: options.relocateImport, lazy, contextModule: options.check === true ? options.contextModule : undefined, ui: options.output === undefined ? undefined : options.ui, uiAdded: options.output === undefined ? options.ui : undefined, errorPage: isErrorPage(basename5(filename)), cardPage: basename5(filename) === CARD_PAGE, special: basename5(filename).startsWith("_") && basename5(filename) !== LAYOUT };
19344
19617
  const analysis = generate(file, script, server, { ...generateOptions, name: SELF });
19345
19618
  const imported = new Map([...script.imports, ...server?.imports ?? []].flatMap((binding) => {
19346
19619
  const kind = binding.typeOnly ? undefined : kindOf(options.importedSignals, binding.source, binding.imported);
@@ -19377,7 +19650,7 @@ function compileKay(original, filename, options = {}) {
19377
19650
  const fenceLints = [script.fence, script.moduleFence, server?.fence].flatMap((fence) => fence ? [...cssImportsWithoutText(fence), ...asyncReplies(fence), ...openRedirects(fence), ...missingCaptchas(fence), ...unreturnedFails(fence)] : []);
19378
19651
  const browserScript = (island !== undefined || options.insideIsland === true) && !routeFile ? scriptFences(script) : [];
19379
19652
  const unusedLints = broken ? [] : [...unreadNames(source, file.template, script, server, found.findings), ...constantSignals(source, [file.script, file.module], found.findings)];
19380
- diagnostics.push(...unboundedFields(server), ...fenceLints, ...serialAwaits(server), ...browserScript.flatMap((fence) => serverOnlyImports(fence)), ...browserScript.includes(script.fence) ? onceReadProps(script.fence, script.props, templateWords(file)) : [], ...unusedLints, ...templateLints(file), ...spelledOutScriptFence(file), ...retiredAllowComments(source), ...deprecatedIslandForms(file, script), ...deprecatedIslandAttributes(file), ...deprecatedChildrenProp(file, script), ...linkFlags(file), ...deprecatedPartsClass(file), ...deprecatedPageSettings(source, server), ...ignoredIslandExport(script, island !== undefined), ...malformedInteractive(script));
19653
+ diagnostics.push(...unboundedFields(server), ...fenceLints, ...serialAwaits(server), ...browserScript.flatMap((fence) => serverOnlyImports(fence)), ...browserScript.includes(script.fence) ? onceReadProps(script.fence, script.props, templateWords(file)) : [], ...unusedLints, ...templateLints(file), ...retiredAllowComments(source), ...deprecatedIslandForms(file, script), ...deprecatedIslandAttributes(file), ...deprecatedChildrenProp(file, script), ...linkFlags(file), ...deprecatedPartsClass(file), ...deprecatedPageSettings(source, server), ...ignoredIslandExport(script, island !== undefined), ...malformedInteractive(script));
19381
19654
  }
19382
19655
  if (checked && pin !== undefined)
19383
19656
  diagnostics.push(...markerMismatch(pin, pageFile));
@@ -19572,13 +19845,13 @@ var init_compiler = __esm(() => {
19572
19845
  init_deprecated_island();
19573
19846
  init_deprecated_page();
19574
19847
  init_deprecated_parts();
19575
- init_deprecated_script_fence();
19576
19848
  init_fence_checks();
19577
19849
  init_fence_redirects();
19578
19850
  init_host();
19579
19851
  init_island_arguments();
19580
19852
  init_island_cause();
19581
19853
  init_island_marker();
19854
+ init_lazy_imports();
19582
19855
  init_link_flags();
19583
19856
  init_lints();
19584
19857
  init_mapping();
@@ -20510,7 +20783,7 @@ var GUARD = "_guard.ts";
20510
20783
  var PARENT = "..";
20511
20784
  var OUTSIDE = "__";
20512
20785
  var WORD_CHARACTER = /[\w$]/;
20513
- var codeOf2 = new WeakMap;
20786
+ var codeOf3 = new WeakMap;
20514
20787
  function shadowPath(root, file) {
20515
20788
  return join11(projectPaths(root).types, `${relative3(root, file).split(sep4).map((part) => part === PARENT ? OUTSIDE : part).join(sep4)}.tsx`);
20516
20789
  }
@@ -20646,10 +20919,10 @@ function inFences(shadow, start, end) {
20646
20919
  return codeIn(shadow).fences.some((span) => start >= span.start && end <= span.end);
20647
20920
  }
20648
20921
  function codeIn(shadow) {
20649
- let spans = codeOf2.get(shadow);
20922
+ let spans = codeOf3.get(shadow);
20650
20923
  if (!spans) {
20651
20924
  const { script, server, module, template } = parseKay(shadow.source);
20652
- codeOf2.set(shadow, spans = { fences: [script, server, module].filter((span) => span !== undefined), expressions: expressionSpans(template) });
20925
+ codeOf3.set(shadow, spans = { fences: [script, server, module].filter((span) => span !== undefined), expressions: expressionSpans(template) });
20653
20926
  }
20654
20927
  return spans;
20655
20928
  }
@@ -20786,7 +21059,7 @@ var NON_BLANK = /\S/;
20786
21059
  var NON_BLANK_OR_END = /\S|$/;
20787
21060
  var SPACE7 = /\s/;
20788
21061
  var INDENTATION = /^[ \t]*$/;
20789
- var LINE_COMMENT = /\/\/.*$/;
21062
+ var LINE_COMMENT2 = /\/\/.*$/;
20790
21063
  var STATEMENT_START2 = /[^\s)\]}]/;
20791
21064
  var EXPECTED_SPACES = /of (\d+) spaces?/;
20792
21065
  var FOUND_SPACES = /found (\d+)\./;
@@ -20889,7 +21162,7 @@ function alignedAfterRewrite(linted, line) {
20889
21162
  } else if (character === "(" || character === "[" || character === "{") {
20890
21163
  const call = character === "(";
20891
21164
  const opened = lineStart(tsx, at);
20892
- brackets.push({ call, line: opened, aligned: call && NON_BLANK.test(tsx.slice(at + 1, lineEnd2(tsx, at)).replace(LINE_COMMENT, "")), arguments: 0, pending: call, locked: false });
21165
+ brackets.push({ call, line: opened, aligned: call && NON_BLANK.test(tsx.slice(at + 1, lineEnd2(tsx, at)).replace(LINE_COMMENT2, "")), arguments: 0, pending: call, locked: false });
20893
21166
  } else if (character === ")" || character === "]" || character === "}") {
20894
21167
  brackets.pop();
20895
21168
  } else if (character === "," && top?.call) {