@farm.js/core 0.1.63 → 0.1.64

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 (186) hide show
  1. package/dist/{agent-mcp-handler-OV4WRFBL.cjs → agent-mcp-handler-OXT73ZBY.cjs} +5 -5
  2. package/dist/{agent-mcp-handler-7QMX2LUY.mjs → agent-mcp-handler-QLFDDTYN.mjs} +4 -4
  3. package/dist/{agent-mcp.d-CCQ-wKwg.d.mts → agent-mcp.d-CO_ABmNK.d.mts} +1 -1
  4. package/dist/{agent-mcp.d-DOJCBSh9.d.ts → agent-mcp.d-QD2WZ9BS.d.ts} +1 -1
  5. package/dist/agent-runtime.d.mts +1 -1
  6. package/dist/agent-runtime.d.ts +1 -1
  7. package/dist/analyzer-ODLF2Z6O.cjs +16 -0
  8. package/dist/{analyzer-WNPQPWFR.mjs → analyzer-Q3QXC6PD.mjs} +3 -2
  9. package/dist/api/route-manager.d.mts +3 -3
  10. package/dist/api/route-manager.d.ts +3 -3
  11. package/dist/api/runtime.d.mts +2 -2
  12. package/dist/api/runtime.d.ts +2 -2
  13. package/dist/api.d.mts +3 -3
  14. package/dist/api.d.ts +3 -3
  15. package/dist/{app-manifest.d-BaA0omsv.d.mts → app-manifest.d-BpKxiU_E.d.mts} +1 -1
  16. package/dist/{app-manifest.d-poayV4lq.d.ts → app-manifest.d-DDmNkYQQ.d.ts} +1 -1
  17. package/dist/app-markdown.cjs +4 -4
  18. package/dist/app-markdown.d.mts +2 -2
  19. package/dist/app-markdown.d.ts +2 -2
  20. package/dist/app-markdown.mjs +3 -3
  21. package/dist/{app.d-DdWxeIGU.d.mts → app.d-kuoVWhWM.d.mts} +4 -4
  22. package/dist/{app.d-D4Dn03E3.d.ts → app.d-x68Cwr0_.d.ts} +4 -4
  23. package/dist/{chunk-LT4VAF5Z.cjs → chunk-2C5L5RPM.cjs} +7 -6
  24. package/dist/{chunk-PVJX4UPA.cjs → chunk-3EBHJET2.cjs} +103 -98
  25. package/dist/{chunk-4DIKLG56.mjs → chunk-6NHSGVVA.mjs} +1 -1
  26. package/dist/{chunk-S2NUYHRY.mjs → chunk-6NNYPY5W.mjs} +327 -13
  27. package/dist/{chunk-PRFNLQSP.cjs → chunk-7XGWBPQQ.cjs} +4 -4
  28. package/dist/{chunk-U6WCUVSV.cjs → chunk-DUSHDZQL.cjs} +9 -9
  29. package/dist/{chunk-GVOMPU3Y.cjs → chunk-EL4364S2.cjs} +209 -32
  30. package/dist/{chunk-QN5WRQSQ.cjs → chunk-FAP7CX7C.cjs} +101 -101
  31. package/dist/{chunk-GPKBUME5.mjs → chunk-FH45OB37.mjs} +2 -2
  32. package/dist/{chunk-55U5QIXQ.mjs → chunk-FIR62CR3.mjs} +1 -1
  33. package/dist/{chunk-MEQN6DDA.cjs → chunk-FJWN7RV4.cjs} +5 -5
  34. package/dist/chunk-IOEXXZK3.mjs +88 -0
  35. package/dist/{chunk-Z74NNER4.cjs → chunk-JCPSA4X5.cjs} +135 -134
  36. package/dist/{chunk-YSXTNSXS.mjs → chunk-K7OZAVOI.mjs} +7 -6
  37. package/dist/{chunk-KVW2M6PI.mjs → chunk-KL7SHLQB.mjs} +1 -1
  38. package/dist/{chunk-RFYL5OLP.mjs → chunk-LQDLEWPO.mjs} +1 -1
  39. package/dist/{chunk-UZZ6IEQP.mjs → chunk-MESQF2JC.mjs} +2 -2
  40. package/dist/{chunk-5L7I6AMY.cjs → chunk-MG356ROI.cjs} +5 -5
  41. package/dist/{chunk-Y2YBNQ3D.cjs → chunk-N3Z3PLHC.cjs} +2 -2
  42. package/dist/{chunk-XICXQXYE.mjs → chunk-NNLFW3P4.mjs} +2 -2
  43. package/dist/{chunk-EYLC6GD6.cjs → chunk-NXFA7G3Y.cjs} +12 -12
  44. package/dist/{chunk-FNHN3RBD.cjs → chunk-O2XFIPNL.cjs} +1 -1
  45. package/dist/{chunk-BA2IA32Q.mjs → chunk-O4FWNLQK.mjs} +3 -3
  46. package/dist/{chunk-DZPR2W6U.cjs → chunk-O6L3YYPM.cjs} +5 -5
  47. package/dist/{chunk-LFFSDZ4Y.cjs → chunk-O7IEMY55.cjs} +3 -3
  48. package/dist/{chunk-6BJJYOFL.cjs → chunk-OLIGNTWU.cjs} +7 -7
  49. package/dist/{chunk-EENTT56C.mjs → chunk-OYF23QLG.mjs} +15 -14
  50. package/dist/{chunk-CBDRR3J3.mjs → chunk-RAH5MT53.mjs} +19 -14
  51. package/dist/{chunk-E72UD6ME.mjs → chunk-RVGSVQWT.mjs} +1 -1
  52. package/dist/{chunk-5IKQ7BIR.cjs → chunk-S25BQIFW.cjs} +16 -16
  53. package/dist/{chunk-LWWDTBGL.cjs → chunk-S7ZW72JH.cjs} +2 -2
  54. package/dist/{chunk-7FFW7DC4.mjs → chunk-SLYDIHLW.mjs} +4 -4
  55. package/dist/{chunk-LA6O5EL2.mjs → chunk-SNFTMSHX.mjs} +1 -1
  56. package/dist/{chunk-PCXIJKPM.mjs → chunk-TNBJ4LZG.mjs} +2 -2
  57. package/dist/{chunk-O27PLNQZ.cjs → chunk-UJ3R2AH2.cjs} +4 -4
  58. package/dist/{chunk-T4TBK5NY.mjs → chunk-VQ4NWOWO.mjs} +2 -2
  59. package/dist/{chunk-ZZ2QKCKW.mjs → chunk-WAY6LOQH.mjs} +1 -1
  60. package/dist/chunk-WBTHHTBO.cjs +88 -0
  61. package/dist/{chunk-O5FCWI6O.mjs → chunk-WFNAOWH4.mjs} +1 -1
  62. package/dist/{chunk-IWRLV46X.cjs → chunk-WMTBBQHY.cjs} +4 -4
  63. package/dist/{chunk-LA45FN37.mjs → chunk-WNYRYI4D.mjs} +10 -10
  64. package/dist/{chunk-CI4UNQHO.cjs → chunk-XBSKPLHF.cjs} +2 -2
  65. package/dist/{chunk-IOF4KXMP.mjs → chunk-XVWSDSUM.mjs} +201 -24
  66. package/dist/{chunk-ANXU3D32.cjs → chunk-XZLZ6YPP.cjs} +346 -32
  67. package/dist/{chunk-QAS7KE7J.cjs → chunk-Y5TOT5F6.cjs} +5 -5
  68. package/dist/{chunk-DPE53XWL.mjs → chunk-ZEXE4TGY.mjs} +1 -1
  69. package/dist/{client-component.d-CSEFlHfG.d.mts → client-component.d-D74pqdea.d.mts} +2 -2
  70. package/dist/{client-component.d-CQLvqLAJ.d.ts → client-component.d-D8VcypQA.d.ts} +2 -2
  71. package/dist/{client-plugins.d-BgPUYPc9.d.ts → client-plugins.d-CXElzotB.d.ts} +8 -1
  72. package/dist/{client-plugins.d-BTF0gZm4.d.mts → client-plugins.d-D4-6hNx7.d.mts} +8 -1
  73. package/dist/client-plugins.d.mts +1 -1
  74. package/dist/client-plugins.d.ts +1 -1
  75. package/dist/client.d.mts +6 -6
  76. package/dist/client.d.ts +6 -6
  77. package/dist/config.d.mts +1 -1
  78. package/dist/config.d.ts +1 -1
  79. package/dist/desktop.d.mts +2 -2
  80. package/dist/desktop.d.ts +2 -2
  81. package/dist/{devtools-HDKTYIZF.mjs → devtools-MX3FE733.mjs} +4 -4
  82. package/dist/{devtools-ZHN5JLVI.cjs → devtools-WET5NAKO.cjs} +5 -5
  83. package/dist/docs.cjs +7 -7
  84. package/dist/docs.d.mts +2 -2
  85. package/dist/docs.d.ts +2 -2
  86. package/dist/docs.mjs +6 -6
  87. package/dist/index.cjs +20 -19
  88. package/dist/{index.d-Coow7bD4.d.ts → index.d-A_x10zGS.d.ts} +1 -1
  89. package/dist/{index.d-Dbjx0ku7.d.mts → index.d-SSgYDv4D.d.mts} +1 -1
  90. package/dist/index.d.mts +16 -16
  91. package/dist/index.d.ts +16 -16
  92. package/dist/index.mjs +19 -18
  93. package/dist/integrations.d.mts +1 -1
  94. package/dist/integrations.d.ts +1 -1
  95. package/dist/internal/app-markdown-runtime.cjs +3 -3
  96. package/dist/internal/app-markdown-runtime.d.mts +2 -2
  97. package/dist/internal/app-markdown-runtime.d.ts +2 -2
  98. package/dist/internal/app-markdown-runtime.mjs +2 -2
  99. package/dist/internal/build-runtime.cjs +21 -20
  100. package/dist/internal/build-runtime.d.mts +3 -3
  101. package/dist/internal/build-runtime.d.ts +3 -3
  102. package/dist/internal/build-runtime.mjs +20 -19
  103. package/dist/internal/cli-runtime.cjs +6 -6
  104. package/dist/internal/cli-runtime.mjs +5 -5
  105. package/dist/internal/client-error-overlay.cjs +4 -4
  106. package/dist/internal/client-error-overlay.mjs +1 -1
  107. package/dist/internal/client-runtime.d.mts +4 -4
  108. package/dist/internal/client-runtime.d.ts +4 -4
  109. package/dist/internal/compression-runtime.d.mts +1 -1
  110. package/dist/internal/compression-runtime.d.ts +1 -1
  111. package/dist/internal/config-runtime.cjs +6 -6
  112. package/dist/internal/config-runtime.d.mts +4 -4
  113. package/dist/internal/config-runtime.d.ts +4 -4
  114. package/dist/internal/config-runtime.mjs +5 -5
  115. package/dist/internal/infra-analytics-runtime.cjs +9 -9
  116. package/dist/internal/infra-analytics-runtime.mjs +7 -7
  117. package/dist/internal/native-server-fns.cjs +5 -4
  118. package/dist/internal/native-server-fns.mjs +4 -3
  119. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  120. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  121. package/dist/internal/production-runtime.cjs +11 -11
  122. package/dist/internal/production-runtime.d.mts +13 -12
  123. package/dist/internal/production-runtime.d.ts +13 -12
  124. package/dist/internal/production-runtime.mjs +10 -10
  125. package/dist/markdown.cjs +2 -2
  126. package/dist/markdown.d.mts +1 -1
  127. package/dist/markdown.d.ts +1 -1
  128. package/dist/markdown.mjs +1 -1
  129. package/dist/middleware.d.mts +3 -3
  130. package/dist/middleware.d.ts +3 -3
  131. package/dist/mobile.d.mts +2 -2
  132. package/dist/mobile.d.ts +2 -2
  133. package/dist/{native-tree-AS5L3ID3.mjs → native-tree-BPEE2LAL.mjs} +2 -2
  134. package/dist/{native-tree-Z2WYUJEV.cjs → native-tree-WOX3JMBG.cjs} +3 -3
  135. package/dist/{navigation-delegate.d-Ca_BV0Wu.d.mts → navigation-delegate.d-DQVYKoaZ.d.mts} +1 -1
  136. package/dist/{navigation-delegate.d-aHiPI6GL.d.ts → navigation-delegate.d-GghbHJuK.d.ts} +1 -1
  137. package/dist/navigation.d.mts +4 -4
  138. package/dist/navigation.d.ts +4 -4
  139. package/dist/plugin.cjs +13 -13
  140. package/dist/plugin.d.mts +3 -3
  141. package/dist/plugin.d.ts +3 -3
  142. package/dist/plugin.mjs +12 -12
  143. package/dist/{production-runtime.d-C0rF7a10.d.ts → production-runtime.d-Bzns3NW9.d.ts} +1 -1
  144. package/dist/{production-runtime.d-CnAsSWgF.d.mts → production-runtime.d-DiFa5vHW.d.mts} +1 -1
  145. package/dist/{render-plan.d-BxeITFT1.d.ts → render-plan.d-CL_Ikfg_.d.ts} +1 -1
  146. package/dist/{render-plan.d-Z-93m5GZ.d.mts → render-plan.d-CcF0MeCf.d.mts} +1 -1
  147. package/dist/renderer-client.d.mts +4 -4
  148. package/dist/renderer-client.d.ts +4 -4
  149. package/dist/{request.d-X7Q1vmGF.d.ts → request.d-B1RnTLri.d.ts} +1 -1
  150. package/dist/{request.d-8_fMFNEb.d.mts → request.d-DarDOCk9.d.mts} +1 -1
  151. package/dist/request.d.mts +2 -2
  152. package/dist/request.d.ts +2 -2
  153. package/dist/{route-rendering.d-BUr3Jp8S.d.ts → route-rendering.d-BTUYCIj4.d.ts} +1 -1
  154. package/dist/{route-rendering.d-BInmBmul.d.mts → route-rendering.d-D_2Ual0-.d.mts} +1 -1
  155. package/dist/{router.d-crorSRiW.d.ts → router.d-CMANF6da.d.ts} +1 -1
  156. package/dist/{router.d-CZQmbpHx.d.mts → router.d-Cuv1jntg.d.mts} +1 -1
  157. package/dist/{routes.d-BknKQcTu.d.ts → routes.d-B6yFe6jm.d.ts} +1 -1
  158. package/dist/{routes.d-D1IrO9KK.d.mts → routes.d-c2HKfrfL.d.mts} +1 -1
  159. package/dist/routes.d.mts +1 -1
  160. package/dist/routes.d.ts +1 -1
  161. package/dist/{rsc-pipeline-3MPRULGA.mjs → rsc-pipeline-3LNVP2OO.mjs} +5 -5
  162. package/dist/{rsc-pipeline-RHEZNBFQ.cjs → rsc-pipeline-G5WELVW3.cjs} +6 -6
  163. package/dist/{runtime-OZKFZQCU.cjs → runtime-DMEULPE7.cjs} +21 -10
  164. package/dist/{runtime-X5UR7VHP.mjs → runtime-HQJ2LLQL.mjs} +19 -8
  165. package/dist/{runtime.d-CCsjTZJW.d.ts → runtime.d-C3RQUj6_.d.ts} +1 -1
  166. package/dist/{runtime.d-CETtpLb-.d.mts → runtime.d-wvh4ngU0.d.mts} +1 -1
  167. package/dist/server-plugins.d.mts +2 -2
  168. package/dist/server-plugins.d.ts +2 -2
  169. package/dist/server.cjs +30 -30
  170. package/dist/server.d.mts +9 -9
  171. package/dist/server.d.ts +9 -9
  172. package/dist/server.mjs +15 -15
  173. package/dist/{spa-router.d-CtSHzXlC.d.mts → spa-router.d-WU_qS5gJ.d.mts} +2 -2
  174. package/dist/{spa-router.d-CCADbSqJ.d.ts → spa-router.d-m8H_Kl_B.d.ts} +2 -2
  175. package/dist/testing.d.mts +1 -1
  176. package/dist/testing.d.ts +1 -1
  177. package/dist/{utils.d-CjyE-npA.d.ts → utils.d-C9dQD5Zg.d.ts} +1 -1
  178. package/dist/{utils.d-zFPHKFFJ.d.mts → utils.d-W9IiEqmW.d.mts} +1 -1
  179. package/dist/version.cjs +2 -2
  180. package/dist/version.mjs +1 -1
  181. package/dist/vite.cjs +13 -13
  182. package/dist/vite.d.mts +4 -4
  183. package/dist/vite.d.ts +4 -4
  184. package/dist/vite.mjs +12 -12
  185. package/package.json +1 -1
  186. package/dist/analyzer-KEA5JVDR.cjs +0 -15
@@ -3,19 +3,26 @@
3
3
 
4
4
 
5
5
 
6
+ var _chunkWBTHHTBOcjs = require('./chunk-WBTHHTBO.cjs');
7
+
8
+
9
+
10
+
11
+
12
+
6
13
 
7
14
 
8
15
  var _chunkV727H3RIcjs = require('./chunk-V727H3RI.cjs');
9
16
 
10
17
 
11
- var _chunkFNHN3RBDcjs = require('./chunk-FNHN3RBD.cjs');
18
+ var _chunkO2XFIPNLcjs = require('./chunk-O2XFIPNL.cjs');
12
19
 
13
20
  // src/mobile/analyzer.ts
14
21
  var _crypto = require('crypto');
15
22
  var _fs = require('fs');
16
23
  var _promises = require('fs/promises');
17
24
  var _path = require('path'); var path = _interopRequireWildcard(_path);
18
- var ANALYZER_VERSION = `5:${_chunkFNHN3RBDcjs.FARM_VERSION}`;
25
+ var ANALYZER_VERSION = `6:${_chunkO2XFIPNLcjs.FARM_VERSION}`;
19
26
  var INTRINSIC_KINDS = {};
20
27
  for (const tag of "div section main article header footer nav aside figure hr li".split(" ")) {
21
28
  INTRINSIC_KINDS[tag] = "View";
@@ -29,6 +36,8 @@ Object.assign(INTRINSIC_KINDS, {
29
36
  a: "Pressable",
30
37
  input: "TextInput",
31
38
  textarea: "TextInput",
39
+ // Native-tier screens submit forms as a browser would (native-tree.ts).
40
+ form: "View",
32
41
  ul: "List",
33
42
  ol: "List"
34
43
  });
@@ -162,6 +171,8 @@ var MAPPED_COMPONENTS = {
162
171
  };
163
172
  var SERVER_FN_FACTORIES = /* @__PURE__ */ new Set(["createServerFn", "createServerQuery"]);
164
173
  var SCRIPT_EXTENSIONS = [".tsx", ".ts", ".jsx", ".js", ".mjs"];
174
+ var COMPONENT_EXTENSIONS = [".vue", ".svelte"];
175
+ var isModuleFile = (file) => [...SCRIPT_EXTENSIONS, ...COMPONENT_EXTENSIONS].some((extension) => file.endsWith(extension));
165
176
  var STYLE_FILE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)(?:\?.*)?$/i;
166
177
  var ASSET_FILE = /\.(?:png|jpe?g|gif|webp|avif|svg|ico|bmp|json|woff2?|ttf|otf|mp3|wav|txt)(?:\?.*)?$/i;
167
178
  var STYLE_PROPERTIES = new Set(
@@ -310,7 +321,7 @@ var SKIP_KEYS = /* @__PURE__ */ new Set([
310
321
  "typeArguments",
311
322
  "decorators"
312
323
  ]);
313
- function analyzeSource(file, source, parseSync) {
324
+ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
314
325
  const facts = {
315
326
  imports: [],
316
327
  blockers: [],
@@ -333,10 +344,11 @@ function analyzeSource(file, source, parseSync) {
333
344
  });
334
345
  };
335
346
  const needsDevice = (node, message) => block(node, "client-logic", message, "native");
336
- const result = parseSync(file, source, { lang: scriptLang(file) });
347
+ let formDepth = 0;
348
+ const result = parseSync(file, source, { lang });
337
349
  if (result.errors.length > 0) {
338
350
  const error = result.errors[0];
339
- const offset = _nullishCoalesce(_optionalChain([error, 'access', _ => _.labels, 'optionalAccess', _2 => _2[0], 'optionalAccess', _3 => _3.start]), () => ( 0));
351
+ const offset = _nullishCoalesce(_optionalChain([error, 'access', _2 => _2.labels, 'optionalAccess', _3 => _3[0], 'optionalAccess', _4 => _4.start]), () => ( 0));
340
352
  facts.blockers.push({ ...locate(starts, offset), rule: "parse-error", message: error.message });
341
353
  return facts;
342
354
  }
@@ -381,10 +393,10 @@ function analyzeSource(file, source, parseSync) {
381
393
  }
382
394
  const declaration = statement.type === "ExportNamedDeclaration" || statement.type === "ExportDefaultDeclaration" ? statement.declaration : statement;
383
395
  if (!declaration) continue;
384
- if (_optionalChain([declaration, 'access', _4 => _4.id, 'optionalAccess', _5 => _5.name]) && /Function|Class/.test(declaration.type)) {
396
+ if (_optionalChain([declaration, 'access', _5 => _5.id, 'optionalAccess', _6 => _6.name]) && /Function|Class/.test(declaration.type)) {
385
397
  topLevel.add(declaration.id.name);
386
398
  }
387
- if (_optionalChain([declaration, 'access', _6 => _6.id, 'optionalAccess', _7 => _7.name]) && declaration.async) asyncFunctions.add(declaration.id.name);
399
+ if (_optionalChain([declaration, 'access', _7 => _7.id, 'optionalAccess', _8 => _8.name]) && declaration.async) asyncFunctions.add(declaration.id.name);
388
400
  if (statement.type === "ExportDefaultDeclaration" && declaration.type === "Identifier") {
389
401
  defaultName = declaration.name;
390
402
  }
@@ -392,10 +404,10 @@ function analyzeSource(file, source, parseSync) {
392
404
  for (const declarator of declaration.declarations) {
393
405
  if (declarator.id.type !== "Identifier") continue;
394
406
  const init = declarator.init;
395
- if (_optionalChain([init, 'optionalAccess', _8 => _8.async])) asyncFunctions.add(declarator.id.name);
396
- const callee = _optionalChain([init, 'optionalAccess', _9 => _9.type]) === "CallExpression" ? init.callee : void 0;
397
- const calleeName = _optionalChain([callee, 'optionalAccess', _10 => _10.type]) === "MemberExpression" ? callee.property.name : _optionalChain([callee, 'optionalAccess', _11 => _11.name]);
398
- if (/Function/.test(_nullishCoalesce(_optionalChain([init, 'optionalAccess', _12 => _12.type]), () => ( ""))) || calleeName && /^(?:memo|forwardRef|lazy)$/.test(calleeName)) {
407
+ if (_optionalChain([init, 'optionalAccess', _9 => _9.async])) asyncFunctions.add(declarator.id.name);
408
+ const callee = _optionalChain([init, 'optionalAccess', _10 => _10.type]) === "CallExpression" ? init.callee : void 0;
409
+ const calleeName = _optionalChain([callee, 'optionalAccess', _11 => _11.type]) === "MemberExpression" ? callee.property.name : _optionalChain([callee, 'optionalAccess', _12 => _12.name]);
410
+ if (/Function/.test(_nullishCoalesce(_optionalChain([init, 'optionalAccess', _13 => _13.type]), () => ( ""))) || calleeName && /^(?:memo|forwardRef|lazy)$/.test(calleeName)) {
399
411
  topLevel.add(declarator.id.name);
400
412
  }
401
413
  }
@@ -428,7 +440,7 @@ function analyzeSource(file, source, parseSync) {
428
440
  const binding = imported.get(root);
429
441
  if (binding) {
430
442
  const member = tag.includes(".") ? binding.name === "*" ? tag.split(".")[1] : "" : binding.name;
431
- kind = _optionalChain([MAPPED_COMPONENTS, 'access', _13 => _13[binding.source], 'optionalAccess', _14 => _14[member]]);
443
+ kind = _optionalChain([MAPPED_COMPONENTS, 'access', _14 => _14[binding.source], 'optionalAccess', _15 => _15[member]]);
432
444
  if (!kind) {
433
445
  const fromApp = /^(?:\.|\/|@\/|~|#)/.test(binding.source);
434
446
  if (!fromApp) {
@@ -464,6 +476,7 @@ function analyzeSource(file, source, parseSync) {
464
476
  const props = {};
465
477
  const style = [];
466
478
  const events = [];
479
+ let submits = false;
467
480
  for (const attribute of opening.attributes) {
468
481
  if (attribute.type === "JSXSpreadAttribute") {
469
482
  if (isIntrinsic)
@@ -486,11 +499,14 @@ function analyzeSource(file, source, parseSync) {
486
499
  continue;
487
500
  }
488
501
  if ((name === "action" || name === "formAction") && isIntrinsic) {
489
- block(attribute, "form-action", `${name} on <${tag}>`);
502
+ if (staticString(value) === void 0) {
503
+ block(attribute, "form-action", `${name} on <${tag}>`);
504
+ }
505
+ submits = true;
490
506
  continue;
491
507
  }
492
508
  if (/^on[A-Z]/.test(name)) {
493
- if (isIntrinsic && kind && !_optionalChain([MAPPED_EVENTS, 'access', _15 => _15[kind], 'optionalAccess', _16 => _16.has, 'call', _17 => _17(name)])) {
509
+ if (isIntrinsic && kind && !_optionalChain([MAPPED_EVENTS, 'access', _16 => _16[kind], 'optionalAccess', _17 => _17.has, 'call', _18 => _18(name)])) {
494
510
  block(attribute, "dom-event", `${name} on <${tag}> has no native event`);
495
511
  } else {
496
512
  needsDevice(attribute, `${name} on <${tag}> runs on the device`);
@@ -518,7 +534,7 @@ function analyzeSource(file, source, parseSync) {
518
534
  continue;
519
535
  }
520
536
  if (name === "style") {
521
- const expression = _optionalChain([value, 'optionalAccess', _18 => _18.type]) === "JSXExpressionContainer" ? value.expression : null;
537
+ const expression = _optionalChain([value, 'optionalAccess', _19 => _19.type]) === "JSXExpressionContainer" ? value.expression : null;
522
538
  if (!expression || expression.type !== "ObjectExpression") {
523
539
  block(attribute, "runtime-style", `<${tag}> style is not an object literal`);
524
540
  continue;
@@ -560,7 +576,8 @@ function analyzeSource(file, source, parseSync) {
560
576
  }
561
577
  if (tag === "input" && name === "type") {
562
578
  const type = staticString(value);
563
- if (type === void 0 || !INPUT_TYPES.has(type)) {
579
+ const formType = formDepth > 0 && (type === "hidden" || type === "submit");
580
+ if (!formType && (type === void 0 || !INPUT_TYPES.has(type))) {
564
581
  block(
565
582
  attribute,
566
583
  "unmapped-element",
@@ -570,13 +587,29 @@ function analyzeSource(file, source, parseSync) {
570
587
  }
571
588
  const literal = value === null ? true : staticString(value);
572
589
  if (literal !== void 0) props[name] = literal;
573
- else if (_optionalChain([value, 'optionalAccess', _19 => _19.type]) === "JSXExpressionContainer" && value.expression.type === "Literal" && (typeof value.expression.value === "number" || typeof value.expression.value === "boolean")) {
590
+ else if (_optionalChain([value, 'optionalAccess', _20 => _20.type]) === "JSXExpressionContainer" && value.expression.type === "Literal" && (typeof value.expression.value === "number" || typeof value.expression.value === "boolean")) {
574
591
  props[name] = value.expression.value;
575
592
  } else props[name] = "{expr}";
576
593
  }
577
594
  if (kind === "TextInput" && events.some((event) => event === "onChange" || event === "onInput")) {
578
595
  wins.add("input");
579
596
  }
597
+ const inForm = formDepth > 0;
598
+ const buttonType = tag === "button" ? _nullishCoalesce(props.type, () => ( "submit")) : void 0;
599
+ if (isIntrinsic && (tag === "button" || kind === "TextInput") && events.length === 0 && !submits && props.type !== "hidden" && (!inForm || buttonType !== void 0 && buttonType !== "submit")) {
600
+ block(
601
+ opening,
602
+ "inert-control",
603
+ inForm ? `<button type="${String(buttonType)}"> does nothing on a native-tier screen` : `<${tag}> has no link or form to submit on a native-tier screen`,
604
+ "native"
605
+ );
606
+ }
607
+ if (isIntrinsic && tag === "form") {
608
+ const method = typeof props.method === "string" ? props.method.toLowerCase() : "get";
609
+ if (props.method === "{expr}" || method !== "get" && method !== "post") {
610
+ block(opening, "form-action", `<form method="${String(props.method)}">`, "native");
611
+ }
612
+ }
580
613
  if (Object.keys(props).length > 0) node.props = props;
581
614
  if (style.length > 0) node.style = style;
582
615
  if (events.length > 0) node.events = events;
@@ -593,7 +626,7 @@ function analyzeSource(file, source, parseSync) {
593
626
  return void 0;
594
627
  case "JSXElement": {
595
628
  const ui = classifyElement(node);
596
- if (INLINE_BOX_TAGS.has(ui.tag) && parent && parent.kind !== "Fragment" && parent.kind !== "Component" && !_optionalChain([parent, 'access', _20 => _20.style, 'optionalAccess', _21 => _21.some, 'call', _22 => _22((token) => token === "flex" || token === "inline-flex")]) && hasBoxStyle(ui)) {
629
+ if (INLINE_BOX_TAGS.has(ui.tag) && parent && parent.kind !== "Fragment" && parent.kind !== "Component" && !_optionalChain([parent, 'access', _21 => _21.style, 'optionalAccess', _22 => _22.some, 'call', _23 => _23((token) => token === "flex" || token === "inline-flex")]) && hasBoxStyle(ui)) {
597
630
  block(
598
631
  node.openingElement,
599
632
  "class-name",
@@ -604,7 +637,10 @@ function analyzeSource(file, source, parseSync) {
604
637
  for (const attribute of node.openingElement.attributes) {
605
638
  visit(attribute.type === "JSXSpreadAttribute" ? attribute.argument : attribute.value);
606
639
  }
640
+ const form = ui.tag === "form";
641
+ if (form) formDepth += 1;
607
642
  visitChildren(node.children, ui);
643
+ if (form) formDepth -= 1;
608
644
  append(parent, ui);
609
645
  return ui;
610
646
  }
@@ -684,7 +720,7 @@ function analyzeSource(file, source, parseSync) {
684
720
  if (calleeName === "setInterval") wins.add("timer");
685
721
  if (callee.type === "Identifier" && SERVER_FN_FACTORIES.has(callee.name)) {
686
722
  const binding = imported.get(callee.name);
687
- if (_optionalChain([binding, 'optionalAccess', _23 => _23.source, 'access', _24 => _24.startsWith, 'call', _25 => _25("@farm.js/core")])) callsServerFactory = true;
723
+ if (_optionalChain([binding, 'optionalAccess', _24 => _24.source, 'access', _25 => _25.startsWith, 'call', _26 => _26("@farm.js/core")])) callsServerFactory = true;
688
724
  }
689
725
  if (calleeName === "map" && callee.type === "MemberExpression" && parent) {
690
726
  const before = facts.elements.total;
@@ -749,11 +785,11 @@ function analyzeSource(file, source, parseSync) {
749
785
  const isDefault = statement.type === "ExportDefaultDeclaration";
750
786
  const declaration = statement.type === "ExportNamedDeclaration" || isDefault ? statement.declaration : statement;
751
787
  const roots = [];
752
- if (_optionalChain([declaration, 'optionalAccess', _26 => _26.type]) === "FunctionDeclaration" || isDefault && /Function/.test(_nullishCoalesce(_optionalChain([declaration, 'optionalAccess', _27 => _27.type]), () => ( "")))) {
788
+ if (_optionalChain([declaration, 'optionalAccess', _27 => _27.type]) === "FunctionDeclaration" || isDefault && /Function/.test(_nullishCoalesce(_optionalChain([declaration, 'optionalAccess', _28 => _28.type]), () => ( "")))) {
753
789
  roots.push([isDefault ? "default" : declaration.id.name, declaration]);
754
- } else if (_optionalChain([declaration, 'optionalAccess', _28 => _28.type]) === "VariableDeclaration") {
790
+ } else if (_optionalChain([declaration, 'optionalAccess', _29 => _29.type]) === "VariableDeclaration") {
755
791
  for (const declarator of declaration.declarations) {
756
- if (declarator.id.type === "Identifier" && /Function/.test(_nullishCoalesce(_optionalChain([declarator, 'access', _29 => _29.init, 'optionalAccess', _30 => _30.type]), () => ( "")))) {
792
+ if (declarator.id.type === "Identifier" && /Function/.test(_nullishCoalesce(_optionalChain([declarator, 'access', _30 => _30.init, 'optionalAccess', _31 => _31.type]), () => ( "")))) {
757
793
  roots.push([declarator.id.name, declarator]);
758
794
  }
759
795
  }
@@ -769,7 +805,7 @@ function analyzeSource(file, source, parseSync) {
769
805
  facts.components[name] = holder.children.length === 1 ? holder.children[0] : holder;
770
806
  }
771
807
  }
772
- if (isDefault && _optionalChain([declaration, 'optionalAccess', _31 => _31.type]) === "Identifier") {
808
+ if (isDefault && _optionalChain([declaration, 'optionalAccess', _32 => _32.type]) === "Identifier") {
773
809
  facts.components.default = { kind: "Component", tag: declaration.name };
774
810
  }
775
811
  }
@@ -780,6 +816,278 @@ function analyzeSource(file, source, parseSync) {
780
816
  facts.blockers.sort((left, right) => left.line - right.line || left.column - right.column);
781
817
  return facts;
782
818
  }
819
+ var COMPONENT_STRUCTURE = /* @__PURE__ */ new Set([
820
+ "template",
821
+ "slot",
822
+ "Transition",
823
+ "TransitionGroup",
824
+ "KeepAlive",
825
+ "Suspense",
826
+ "svelte:head",
827
+ "svelte:fragment",
828
+ "svelte:options",
829
+ "svelte:window",
830
+ "svelte:body",
831
+ "svelte:document",
832
+ "svelte:boundary"
833
+ ]);
834
+ var COMPONENT_DYNAMIC = /* @__PURE__ */ new Set(["component", "svelte:element", "svelte:component", "Teleport"]);
835
+ var VOID_ELEMENTS = new Set(
836
+ "area base br col embed hr img input link meta source track wbr".split(" ")
837
+ );
838
+ function analyzeComponentSource(file, source, parseSync) {
839
+ const blocks = _chunkWBTHHTBOcjs.readFarmComponentBlocks.call(void 0, file, source);
840
+ const name = blocks.kind === "vue" ? "Vue" : "Svelte";
841
+ const scripts = _chunkWBTHHTBOcjs.keepFarmComponentRanges.call(void 0, source, blocks.scripts);
842
+ const typed = blocks.scripts.some((script) => script.attributes.lang === "tsx") ? "tsx" : "ts";
843
+ const facts = analyzeSource(file, scripts, parseSync, typed);
844
+ facts.blockers = facts.blockers.filter((blocker) => blocker.rule !== "client-logic");
845
+ const starts = lineStarts(source);
846
+ const block = (offset, rule, message, only) => facts.blockers.push({ ...locate(starts, offset), rule, message, ...only ? { only } : {} });
847
+ facts.blockers.push({
848
+ line: 1,
849
+ column: 1,
850
+ rule: "renderer-component",
851
+ message: `a ${name} component has no React Native port`,
852
+ only: "react-native"
853
+ });
854
+ for (const script of _chunkWBTHHTBOcjs.farmComponentModuleScripts.call(void 0, blocks)) {
855
+ const hydrate = /\bexport\s+const\s+hydrate\s*=\s*true\b/.exec(
856
+ source.slice(script.start, script.end)
857
+ );
858
+ if (hydrate) {
859
+ block(
860
+ script.start + hydrate.index,
861
+ "client-logic",
862
+ "it exports hydrate = true, which hydrates the page in the browser",
863
+ "native"
864
+ );
865
+ }
866
+ }
867
+ const styles = blocks.styles.filter((style) => !style.attributes.lang || style.attributes.lang === "css").map((style) => source.slice(style.start, style.end));
868
+ if (styles.length > 0) facts.styles = styles;
869
+ for (const style of blocks.styles) {
870
+ if (style.attributes.lang && style.attributes.lang !== "css") {
871
+ block(
872
+ style.start,
873
+ "css-import",
874
+ `<style lang="${String(style.attributes.lang)}"> is not CSS`
875
+ );
876
+ }
877
+ }
878
+ const imported = /* @__PURE__ */ new Set();
879
+ for (const script of blocks.scripts) {
880
+ const text = source.slice(script.start, script.end);
881
+ for (const match of text.matchAll(/\bimport\s+(?:type\s+)?([\w$]+)\s*(?:,|from\b)/g)) {
882
+ imported.add(match[1]);
883
+ }
884
+ for (const match of text.matchAll(/\bimport\s+(?:[\w$]+\s*,\s*)?\{([^}]*)\}/g)) {
885
+ for (const part of match[1].split(",")) {
886
+ const local = _optionalChain([part, 'access', _33 => _33.trim, 'call', _34 => _34(), 'access', _35 => _35.split, 'call', _36 => _36(/\s+as\s+/), 'access', _37 => _37.pop, 'call', _38 => _38(), 'optionalAccess', _39 => _39.trim, 'call', _40 => _40()]);
887
+ if (local) imported.add(local);
888
+ }
889
+ }
890
+ }
891
+ const pascal = (tag) => tag.replace(/(^|-)([a-z])/g, (_, __, letter) => letter.toUpperCase());
892
+ let formDepth = 0;
893
+ const open = [];
894
+ for (const range of blocks.markup) {
895
+ const markup = source.slice(range.start, range.end);
896
+ let index = 0;
897
+ while (index < markup.length) {
898
+ const at = range.start + index;
899
+ if (markup.startsWith("<!--", index)) {
900
+ const end = markup.indexOf("-->", index + 4);
901
+ index = end === -1 ? markup.length : end + 3;
902
+ continue;
903
+ }
904
+ if (markup[index] === "{") {
905
+ const end = closeBrace(markup, index);
906
+ if (blocks.kind === "svelte" && /^\{@html\b/.test(markup.slice(index))) {
907
+ block(at, "dangerously-set-inner-html", "{@html} renders raw HTML");
908
+ }
909
+ index = end;
910
+ continue;
911
+ }
912
+ if (markup[index] !== "<") {
913
+ index += 1;
914
+ continue;
915
+ }
916
+ const closing = markup[index + 1] === "/";
917
+ const nameMatch = /^[A-Za-z][\w:.-]*/.exec(markup.slice(index + (closing ? 2 : 1)));
918
+ if (!nameMatch) {
919
+ index += 1;
920
+ continue;
921
+ }
922
+ const tag = nameMatch[0];
923
+ let cursor = index + (closing ? 2 : 1) + tag.length;
924
+ const attributes = [];
925
+ let selfClosing = false;
926
+ while (cursor < markup.length && markup[cursor] !== ">") {
927
+ const char = markup[cursor];
928
+ if (/\s/.test(char)) {
929
+ cursor += 1;
930
+ continue;
931
+ }
932
+ if (char === "/" && markup[cursor + 1] === ">") {
933
+ selfClosing = true;
934
+ cursor += 1;
935
+ continue;
936
+ }
937
+ if (char === "{") {
938
+ attributes.push({ name: "{", dynamic: true, offset: range.start + cursor });
939
+ cursor = closeBrace(markup, cursor);
940
+ continue;
941
+ }
942
+ const attrName = _nullishCoalesce(_optionalChain([/^[^\s=/>]+/, 'access', _41 => _41.exec, 'call', _42 => _42(markup.slice(cursor)), 'optionalAccess', _43 => _43[0]]), () => ( char));
943
+ const attrOffset = range.start + cursor;
944
+ cursor += attrName.length;
945
+ while (/\s/.test(_nullishCoalesce(markup[cursor], () => ( "")))) cursor += 1;
946
+ let value2;
947
+ let braced = false;
948
+ if (markup[cursor] === "=") {
949
+ cursor += 1;
950
+ while (/\s/.test(_nullishCoalesce(markup[cursor], () => ( "")))) cursor += 1;
951
+ const quote = markup[cursor];
952
+ if (quote === '"' || quote === "'") {
953
+ const end = markup.indexOf(quote, cursor + 1);
954
+ value2 = markup.slice(cursor + 1, end === -1 ? markup.length : end);
955
+ cursor = end === -1 ? markup.length : end + 1;
956
+ } else if (quote === "{") {
957
+ const end = closeBrace(markup, cursor);
958
+ value2 = markup.slice(cursor, end);
959
+ braced = true;
960
+ cursor = end;
961
+ } else {
962
+ value2 = _nullishCoalesce(_optionalChain([/^[^\s>]+/, 'access', _44 => _44.exec, 'call', _45 => _45(markup.slice(cursor)), 'optionalAccess', _46 => _46[0]]), () => ( ""));
963
+ cursor += value2.length;
964
+ }
965
+ }
966
+ const dynamic = braced || attrName.startsWith(":") || attrName.startsWith("v-bind:") || attrName.startsWith("@") || attrName.startsWith("v-on:") || blocks.kind === "svelte" && value2 !== void 0 && /\{/.test(value2);
967
+ attributes.push({ name: attrName, value: value2, dynamic, offset: attrOffset });
968
+ }
969
+ index = cursor + 1;
970
+ if (closing) {
971
+ const position = open.lastIndexOf(tag);
972
+ if (position !== -1) {
973
+ for (const closed of open.splice(position)) if (closed === "form") formDepth -= 1;
974
+ }
975
+ continue;
976
+ }
977
+ const element = !selfClosing && !VOID_ELEMENTS.has(tag.toLowerCase());
978
+ if (element) open.push(tag);
979
+ if (tag === "form" && element) formDepth += 1;
980
+ for (const attribute of attributes) {
981
+ if (attribute.name === "v-html") {
982
+ block(attribute.offset, "dangerously-set-inner-html", "v-html renders raw HTML");
983
+ }
984
+ if (attribute.name.toLowerCase() === "contenteditable") {
985
+ block(attribute.offset, "content-editable", "contentEditable");
986
+ }
987
+ }
988
+ if (COMPONENT_STRUCTURE.has(tag)) continue;
989
+ if (COMPONENT_DYNAMIC.has(tag) || attributes.some((attribute) => attribute.name === "is")) {
990
+ block(at, "dynamic-component", `<${tag}> picks what it renders at runtime`);
991
+ continue;
992
+ }
993
+ const intrinsic = /^[a-z][a-z0-9]*$/.test(tag);
994
+ if (!intrinsic) {
995
+ if (!imported.has(tag) && !imported.has(pascal(tag))) {
996
+ block(at, "dynamic-component", `<${tag}> is not a component this file imports`);
997
+ }
998
+ continue;
999
+ }
1000
+ const kind = INTRINSIC_KINDS[tag];
1001
+ if (!facts.tags.includes(tag)) facts.tags.push(tag);
1002
+ facts.elements.total += 1;
1003
+ if (!kind) {
1004
+ block(at, "unmapped-element", `<${tag}> has no native mapping`);
1005
+ continue;
1006
+ }
1007
+ facts.elements.mapped += 1;
1008
+ facts.elements.byKind[kind] = (_nullishCoalesce(facts.elements.byKind[kind], () => ( 0))) + 1;
1009
+ const value = (attr) => attributes.find((attribute) => attribute.name.toLowerCase() === attr);
1010
+ const boundAttribute = (attr) => attributes.find(
1011
+ (attribute) => attribute.dynamic && (attribute.name === `:${attr}` || attribute.name === `v-bind:${attr}` || attribute.name === attr) || attr === "class" && attribute.name.startsWith("class:")
1012
+ );
1013
+ const classes = value("class");
1014
+ if (boundAttribute("class")) {
1015
+ block(at, "runtime-class-name", `<${tag}> builds its class names at runtime`);
1016
+ } else if (_optionalChain([classes, 'optionalAccess', _47 => _47.value])) {
1017
+ for (const token of classes.value.split(/\s+/).filter(Boolean)) {
1018
+ const problem = classifyClass(token);
1019
+ if (problem && /^class ".*" is not in the native Tailwind subset$/.test(problem)) {
1020
+ facts.appClasses.push({ name: token, ...locate(starts, classes.offset) });
1021
+ } else if (problem) block(classes.offset, "class-name", problem);
1022
+ else {
1023
+ const native = _chunkV727H3RIcjs.farmNativeClassProblem.call(void 0, token);
1024
+ if (native) block(classes.offset, "class-name", native, "native");
1025
+ }
1026
+ }
1027
+ }
1028
+ const style = value("style");
1029
+ if (boundAttribute("style")) {
1030
+ block(at, "runtime-style", `<${tag}> style is computed at runtime`);
1031
+ } else if (_optionalChain([style, 'optionalAccess', _48 => _48.value])) {
1032
+ for (const declaration of _chunkV727H3RIcjs.resolveFarmNativeInlineStyle.call(void 0, style.value).unsupported) {
1033
+ block(
1034
+ style.offset,
1035
+ "style",
1036
+ `<${tag}> style "${declaration}" has no native-tier style`,
1037
+ "native"
1038
+ );
1039
+ }
1040
+ }
1041
+ const type = value("type");
1042
+ if (tag === "input") {
1043
+ const inputType = _optionalChain([type, 'optionalAccess', _49 => _49.dynamic]) ? void 0 : (_nullishCoalesce(_optionalChain([type, 'optionalAccess', _50 => _50.value]), () => ( "text"))).toLowerCase();
1044
+ const formType = formDepth > 0 && (inputType === "hidden" || inputType === "submit");
1045
+ if (!formType && (inputType === void 0 || !INPUT_TYPES.has(inputType))) {
1046
+ block(
1047
+ at,
1048
+ "unmapped-element",
1049
+ `<input type="${_nullishCoalesce(inputType, () => ( "{expr}"))}"> has no native mapping`
1050
+ );
1051
+ continue;
1052
+ }
1053
+ if (inputType === "hidden") continue;
1054
+ }
1055
+ const buttonType = tag === "button" ? (_nullishCoalesce(_optionalChain([type, 'optionalAccess', _51 => _51.value]), () => ( "submit"))).toLowerCase() : void 0;
1056
+ if ((tag === "button" || kind === "TextInput") && !value("action") && !value("formaction") && (formDepth === 0 || buttonType !== void 0 && buttonType !== "submit")) {
1057
+ block(
1058
+ at,
1059
+ "inert-control",
1060
+ formDepth > 0 ? `<button type="${buttonType}"> does nothing on a native-tier screen` : `<${tag}> has no link or form to submit on a native-tier screen`,
1061
+ "native"
1062
+ );
1063
+ }
1064
+ if (tag === "form") {
1065
+ const method = value("method");
1066
+ const methodValue = (_nullishCoalesce(_optionalChain([method, 'optionalAccess', _52 => _52.value]), () => ( "get"))).toLowerCase();
1067
+ if (_optionalChain([method, 'optionalAccess', _53 => _53.dynamic]) || methodValue !== "get" && methodValue !== "post") {
1068
+ block(at, "form-action", `<form method="${_nullishCoalesce(_optionalChain([method, 'optionalAccess', _54 => _54.value]), () => ( "{expr}"))}">`, "native");
1069
+ }
1070
+ }
1071
+ }
1072
+ }
1073
+ return facts;
1074
+ }
1075
+ function closeBrace(text, start) {
1076
+ let depth = 0;
1077
+ for (let index = start; index < text.length; index += 1) {
1078
+ const char = text[index];
1079
+ if (char === '"' || char === "'" || char === "`") {
1080
+ const end = text.indexOf(char, index + 1);
1081
+ if (end === -1) return text.length;
1082
+ index = end;
1083
+ } else if (char === "{") depth += 1;
1084
+ else if (char === "}") {
1085
+ depth -= 1;
1086
+ if (depth === 0) return index + 1;
1087
+ }
1088
+ }
1089
+ return text.length;
1090
+ }
783
1091
  function readAliases(root, srcDir) {
784
1092
  const aliases = [{ prefix: "@/", targets: [path.join(root, srcDir) + path.sep] }];
785
1093
  try {
@@ -836,7 +1144,7 @@ function classifyPackage(fact, serverBoundary) {
836
1144
  }
837
1145
  if (specifier.startsWith("@farm.js/core")) {
838
1146
  const portable = CORE_PORTABLE[specifier];
839
- const unmapped = fact.names.filter((name2) => !_optionalChain([portable, 'optionalAccess', _32 => _32.has, 'call', _33 => _33(name2)]));
1147
+ const unmapped = fact.names.filter((name2) => !_optionalChain([portable, 'optionalAccess', _55 => _55.has, 'call', _56 => _56(name2)]));
840
1148
  if (unmapped.length > 0 || !portable) {
841
1149
  return {
842
1150
  ...at,
@@ -922,11 +1230,14 @@ async function analyzeFarmMobileRoutes(options) {
922
1230
  let pending = facts.get(file);
923
1231
  if (!pending) {
924
1232
  pending = _promises.readFile.call(void 0, file, "utf8").then((source) => {
925
- const hash = _crypto.createHash.call(void 0, "sha1").update(file.endsWith(".tsx") ? "tsx\0" : file.endsWith(".ts") ? "ts\0" : "jsx\0").update(source).digest("hex");
1233
+ const component = _chunkWBTHHTBOcjs.farmComponentKind.call(void 0, file);
1234
+ const hash = _crypto.createHash.call(void 0, "sha1").update(
1235
+ component ? `${component}\0` : file.endsWith(".tsx") ? "tsx\0" : file.endsWith(".ts") ? "ts\0" : "jsx\0"
1236
+ ).update(source).digest("hex");
926
1237
  let result = cache.modules[hash];
927
1238
  if (result) cached += 1;
928
1239
  else {
929
- result = analyzeSource(file, source, parseSync);
1240
+ result = component ? analyzeComponentSource(file, source, parseSync) : analyzeSource(file, source, parseSync);
930
1241
  parsed += 1;
931
1242
  }
932
1243
  used[hash] = result;
@@ -990,7 +1301,7 @@ async function analyzeFarmMobileRoutes(options) {
990
1301
  }
991
1302
  };
992
1303
  }
993
- if (!SCRIPT_EXTENSIONS.some((extension) => file.endsWith(extension))) {
1304
+ if (!isModuleFile(file)) {
994
1305
  return {
995
1306
  fact,
996
1307
  blocker: {
@@ -1027,8 +1338,7 @@ async function analyzeFarmMobileRoutes(options) {
1027
1338
  const scripts = /* @__PURE__ */ new Set();
1028
1339
  for (const { page, layouts } of entries.values()) {
1029
1340
  for (const file of [page, ...layouts]) {
1030
- if (file && SCRIPT_EXTENSIONS.some((extension) => file.endsWith(extension)))
1031
- scripts.add(file);
1341
+ if (file && isModuleFile(file)) scripts.add(file);
1032
1342
  }
1033
1343
  }
1034
1344
  await Promise.all([...scripts].map(visitModule));
@@ -1048,7 +1358,7 @@ async function analyzeFarmMobileRoutes(options) {
1048
1358
  const allStylesheets = /* @__PURE__ */ new Set();
1049
1359
  const unreadStylesheets = /* @__PURE__ */ new Set();
1050
1360
  for (const [route, { page, layouts }] of entries) {
1051
- if (!page && _optionalChain([options, 'access', _34 => _34.nativeOnlyRoutes, 'optionalAccess', _35 => _35.has, 'call', _36 => _36(route)])) continue;
1361
+ if (!page && _optionalChain([options, 'access', _57 => _57.nativeOnlyRoutes, 'optionalAccess', _58 => _58.has, 'call', _59 => _59(route)])) continue;
1052
1362
  const blockers = [];
1053
1363
  const wins = /* @__PURE__ */ new Set();
1054
1364
  const elements = { total: 0, mapped: 0, byKind: {} };
@@ -1059,6 +1369,7 @@ async function analyzeFarmMobileRoutes(options) {
1059
1369
  const tags = /* @__PURE__ */ new Set();
1060
1370
  const graph = [];
1061
1371
  const layoutClasses = /* @__PURE__ */ new Set();
1372
+ const componentSheets = [];
1062
1373
  const walk = (file, entry, layout) => {
1063
1374
  if (seen.has(file)) return;
1064
1375
  seen.add(file);
@@ -1113,6 +1424,9 @@ async function analyzeFarmMobileRoutes(options) {
1113
1424
  for (const appClass of moduleFacts.appClasses)
1114
1425
  appClasses.push({ file: label, ...appClass });
1115
1426
  for (const tag of moduleFacts.tags) tags.add(tag);
1427
+ for (const css of _nullishCoalesce(moduleFacts.styles, () => ( []))) {
1428
+ componentSheets.push(_chunkV727H3RIcjs.parseFarmNativeStylesheet.call(void 0, css));
1429
+ }
1116
1430
  }
1117
1431
  for (const win of moduleFacts.wins) wins.add(win);
1118
1432
  elements.total += moduleFacts.elements.total;
@@ -1127,7 +1441,7 @@ async function analyzeFarmMobileRoutes(options) {
1127
1441
  if (entryImport.stylesheet) {
1128
1442
  stylesheets.add(entryImport.stylesheet);
1129
1443
  allStylesheets.add(entryImport.stylesheet);
1130
- } else if (_optionalChain([entryImport, 'access', _37 => _37.blocker, 'optionalAccess', _38 => _38.rule]) === "css-import") {
1444
+ } else if (_optionalChain([entryImport, 'access', _60 => _60.blocker, 'optionalAccess', _61 => _61.rule]) === "css-import") {
1131
1445
  unreadStylesheets.add(entryImport.fact.source);
1132
1446
  }
1133
1447
  if (entryImport.blocker) add({ file: label, ...entryImport.blocker });
@@ -1155,7 +1469,7 @@ async function analyzeFarmMobileRoutes(options) {
1155
1469
  ir.root = `${relative2(root, page)}#default`;
1156
1470
  }
1157
1471
  for (const layout of layouts) walk(layout, true, true);
1158
- const sheets = [...stylesheets].map(readStylesheet);
1472
+ const sheets = [...[...stylesheets].map(readStylesheet), ...componentSheets];
1159
1473
  for (const appClass of appClasses) {
1160
1474
  const { styled, problems } = _chunkV727H3RIcjs.inspectFarmNativeStylesheets.call(void 0, sheets, { class: appClass.name });
1161
1475
  const at = { file: appClass.file, line: appClass.line, column: appClass.column };
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkMEQN6DDAcjs = require('./chunk-MEQN6DDA.cjs');
3
+ var _chunkFJWN7RV4cjs = require('./chunk-FJWN7RV4.cjs');
4
4
 
5
5
 
6
6
 
7
- var _chunkLT4VAF5Zcjs = require('./chunk-LT4VAF5Z.cjs');
7
+ var _chunk2C5L5RPMcjs = require('./chunk-2C5L5RPM.cjs');
8
8
 
9
9
 
10
10
 
@@ -105,10 +105,10 @@ function collectFarmDefaultMCPPages(sources, options) {
105
105
  for (const source of sources) {
106
106
  const module = isRecord(source.module) ? source.module : void 0;
107
107
  if (_optionalChain([module, 'optionalAccess', _ => _.__farmRouteGuard])) continue;
108
- if (!_chunkLT4VAF5Zcjs.isFarmMarkdownMirrorExposed.call(void 0, options.markdown, source.pattern)) continue;
108
+ if (!_chunk2C5L5RPMcjs.isFarmMarkdownMirrorExposed.call(void 0, options.markdown, source.pattern)) continue;
109
109
  readable.push({ pattern: source.pattern, metadata: _optionalChain([module, 'optionalAccess', _2 => _2.metadata]) });
110
110
  }
111
- return _chunkMEQN6DDAcjs.collectFarmLlmsTxtPages.call(void 0, readable, {
111
+ return _chunkFJWN7RV4cjs.collectFarmLlmsTxtPages.call(void 0, readable, {
112
112
  origin: options.origin,
113
113
  basePath: options.basePath,
114
114
  markdown: options.markdown
@@ -118,7 +118,7 @@ function collectFarmDefaultMCPPages(sources, options) {
118
118
  url: `${options.origin}${_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, page.path, options.basePath)}`,
119
119
  ...page.description ? { description: page.description } : {},
120
120
  markdownUrl: `${options.origin}${_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0,
121
- _chunkLT4VAF5Zcjs.getFarmMarkdownMirrorPath.call(void 0, page.path),
121
+ _chunk2C5L5RPMcjs.getFarmMarkdownMirrorPath.call(void 0, page.path),
122
122
  options.basePath
123
123
  )}`
124
124
  }));
@@ -18,7 +18,7 @@ import {
18
18
  } from "./chunk-22W4FNTG.mjs";
19
19
  import {
20
20
  farmAcceptQuality
21
- } from "./chunk-YSXTNSXS.mjs";
21
+ } from "./chunk-K7OZAVOI.mjs";
22
22
  import {
23
23
  matchesFarmIfNoneMatch
24
24
  } from "./chunk-QDWMCFTH.mjs";
@@ -1,5 +1,5 @@
1
- import { R as RouteRenderingOptions, D as DirectiveRenderingConfig, a as RouteRenderingConfig } from './route-rendering.d-BInmBmul.mjs';
2
- import { i as RouteModule, b6 as SSGCollectionResult, b7 as SSGPage } from './client-plugins.d-BTF0gZm4.mjs';
1
+ import { R as RouteRenderingOptions, D as DirectiveRenderingConfig, a as RouteRenderingConfig } from './route-rendering.d-D_2Ual0-.mjs';
2
+ import { i as RouteModule, b6 as SSGCollectionResult, b7 as SSGPage } from './client-plugins.d-D4-6hNx7.mjs';
3
3
  import { F as FarmIslandStrategy } from './island.d-CfGru1MO.mjs';
4
4
 
5
5
  /**