@farm.js/core 0.1.64 → 0.1.66

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 (90) hide show
  1. package/dist/{analyzer-Q3QXC6PD.mjs → analyzer-4UFP4HVP.mjs} +3 -3
  2. package/dist/analyzer-H7SIX6BJ.cjs +16 -0
  3. package/dist/{chunk-XVWSDSUM.mjs → chunk-27FPUFWR.mjs} +60 -5
  4. package/dist/{chunk-JCEFKP5M.mjs → chunk-423SSBYQ.mjs} +6 -0
  5. package/dist/{chunk-SLYDIHLW.mjs → chunk-435QJNC2.mjs} +2 -2
  6. package/dist/{chunk-XZLZ6YPP.cjs → chunk-4OSOLDPL.cjs} +118 -50
  7. package/dist/{chunk-MG356ROI.cjs → chunk-4TVPYN32.cjs} +3 -3
  8. package/dist/chunk-672ISQIG.mjs +3704 -0
  9. package/dist/{chunk-NXFA7G3Y.cjs → chunk-752IHQTD.cjs} +4 -4
  10. package/dist/chunk-7ONGIFYX.cjs +3704 -0
  11. package/dist/{chunk-RAH5MT53.mjs → chunk-AZUUKA66.mjs} +153 -42
  12. package/dist/{chunk-O2XFIPNL.cjs → chunk-BIF5MLTH.cjs} +1 -1
  13. package/dist/{chunk-FH45OB37.mjs → chunk-BYRZ5VTH.mjs} +1 -1
  14. package/dist/{chunk-V727H3RI.cjs → chunk-CCAUIBIS.cjs} +6 -0
  15. package/dist/{chunk-DUSHDZQL.cjs → chunk-CHYTADNK.cjs} +15 -13
  16. package/dist/chunk-CJNAUEVC.mjs +34 -0
  17. package/dist/{chunk-S25BQIFW.cjs → chunk-DVKH2RVN.cjs} +2 -2
  18. package/dist/{chunk-FAP7CX7C.cjs → chunk-E4UDLFWR.cjs} +527 -3019
  19. package/dist/{chunk-EFZGB7JC.cjs → chunk-E5UN4OWX.cjs} +1 -0
  20. package/dist/{chunk-WNYRYI4D.mjs → chunk-EMNKZGF4.mjs} +380 -2872
  21. package/dist/{chunk-VVTJTMGQ.cjs → chunk-GL7N5UHF.cjs} +4 -4
  22. package/dist/{chunk-UR25Z5Z6.mjs → chunk-HCGWDRZO.mjs} +1 -1
  23. package/dist/{chunk-EL4364S2.cjs → chunk-HZPKJRYA.cjs} +74 -19
  24. package/dist/{chunk-3EBHJET2.cjs → chunk-IT6WRNGB.cjs} +380 -269
  25. package/dist/{chunk-LQDLEWPO.mjs → chunk-MPIGW42F.mjs} +1 -1
  26. package/dist/{chunk-S7ZW72JH.cjs → chunk-MPJEIHW2.cjs} +2 -2
  27. package/dist/{chunk-53ZCZ46B.cjs → chunk-NHQM2Q4I.cjs} +2 -1
  28. package/dist/{chunk-UYRI6U3P.mjs → chunk-O75GQVUK.mjs} +2 -1
  29. package/dist/{chunk-OYF23QLG.mjs → chunk-OB7VKCUZ.mjs} +38 -33
  30. package/dist/{chunk-JCPSA4X5.cjs → chunk-OP7LHY4Y.cjs} +128 -123
  31. package/dist/{chunk-O7IEMY55.cjs → chunk-RY4ABNPE.cjs} +3 -3
  32. package/dist/{chunk-6NHSGVVA.mjs → chunk-SK7QSNWE.mjs} +1 -1
  33. package/dist/{chunk-NNLFW3P4.mjs → chunk-TKK5QHKZ.mjs} +1 -1
  34. package/dist/{chunk-ZNXTU4YH.mjs → chunk-TM2E623I.mjs} +1 -0
  35. package/dist/{chunk-PAKCHVUS.mjs → chunk-TPA2PV5J.mjs} +3 -35
  36. package/dist/{chunk-6NNYPY5W.mjs → chunk-UBMHQVWN.mjs} +78 -10
  37. package/dist/{chunk-BPNOYILC.cjs → chunk-UVV3I5QA.cjs} +3 -35
  38. package/dist/{chunk-N3Z3PLHC.cjs → chunk-VBCQ5WOI.cjs} +6 -6
  39. package/dist/{chunk-WFNAOWH4.mjs → chunk-WFWFECDW.mjs} +2 -2
  40. package/dist/{chunk-SNFTMSHX.mjs → chunk-WVYRLP5E.mjs} +1 -1
  41. package/dist/{chunk-O4FWNLQK.mjs → chunk-XBSLKXBL.mjs} +10 -8
  42. package/dist/chunk-ZIHWAN55.cjs +34 -0
  43. package/dist/{devtools-WET5NAKO.cjs → devtools-N2JQCMXB.cjs} +5 -4
  44. package/dist/{devtools-MX3FE733.mjs → devtools-NZUVNUP3.mjs} +4 -3
  45. package/dist/docs.cjs +6 -5
  46. package/dist/docs.mjs +5 -4
  47. package/dist/environment/vite.cjs +9 -2
  48. package/dist/environment/vite.d.mts +3 -0
  49. package/dist/environment/vite.d.ts +3 -0
  50. package/dist/environment/vite.mjs +8 -1
  51. package/dist/index.cjs +22 -21
  52. package/dist/index.mjs +21 -20
  53. package/dist/internal/build-runtime.cjs +20 -19
  54. package/dist/internal/build-runtime.mjs +19 -18
  55. package/dist/internal/cli-runtime.cjs +6 -5
  56. package/dist/internal/cli-runtime.mjs +5 -4
  57. package/dist/internal/client-error-overlay.cjs +4 -4
  58. package/dist/internal/client-error-overlay.mjs +1 -1
  59. package/dist/internal/config-runtime.cjs +6 -5
  60. package/dist/internal/config-runtime.mjs +5 -4
  61. package/dist/internal/infra-analytics-runtime.cjs +6 -6
  62. package/dist/internal/infra-analytics-runtime.mjs +4 -4
  63. package/dist/internal/native-server-fns.cjs +5 -5
  64. package/dist/internal/native-server-fns.mjs +4 -4
  65. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  66. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  67. package/dist/internal/production-runtime.cjs +7 -7
  68. package/dist/internal/production-runtime.d.mts +14 -0
  69. package/dist/internal/production-runtime.d.ts +14 -0
  70. package/dist/internal/production-runtime.mjs +6 -6
  71. package/dist/{native-tree-WOX3JMBG.cjs → native-tree-7LPH57Z4.cjs} +3 -3
  72. package/dist/{native-tree-BPEE2LAL.mjs → native-tree-VV6WN3GX.mjs} +2 -2
  73. package/dist/plugin.cjs +11 -10
  74. package/dist/plugin.mjs +10 -9
  75. package/dist/{port-UFUZL6RI.mjs → port-CLL4BC4O.mjs} +1 -1
  76. package/dist/{port-VTLHPZOI.cjs → port-HASZTQGY.cjs} +9 -9
  77. package/dist/{rsc-pipeline-3LNVP2OO.mjs → rsc-pipeline-7PNVJSTR.mjs} +6 -5
  78. package/dist/{rsc-pipeline-G5WELVW3.cjs → rsc-pipeline-Z7QBZOIJ.cjs} +7 -6
  79. package/dist/{runtime-DMEULPE7.cjs → runtime-FKFCUHSK.cjs} +21 -20
  80. package/dist/{runtime-HQJ2LLQL.mjs → runtime-QQHX4BP3.mjs} +12 -11
  81. package/dist/server.cjs +36 -35
  82. package/dist/server.mjs +19 -18
  83. package/dist/version.cjs +2 -2
  84. package/dist/version.mjs +1 -1
  85. package/dist/vite.cjs +14 -12
  86. package/dist/vite.mjs +13 -11
  87. package/package.json +1 -1
  88. package/dist/analyzer-ODLF2Z6O.cjs +0 -16
  89. package/dist/chunk-NK2VWS7P.cjs +0 -954
  90. package/dist/chunk-ZQ5BDNKW.mjs +0 -954
@@ -3,10 +3,10 @@ import {
3
3
  analyzeFarmMobileRoutes,
4
4
  readAliases,
5
5
  resolveFile
6
- } from "./chunk-6NNYPY5W.mjs";
6
+ } from "./chunk-UBMHQVWN.mjs";
7
7
  import "./chunk-IOEXXZK3.mjs";
8
- import "./chunk-JCEFKP5M.mjs";
9
- import "./chunk-LQDLEWPO.mjs";
8
+ import "./chunk-423SSBYQ.mjs";
9
+ import "./chunk-MPIGW42F.mjs";
10
10
  import "./chunk-Y6FXYEAI.mjs";
11
11
  export {
12
12
  CORE_PORTABLE,
@@ -0,0 +1,16 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+ var _chunk4OSOLDPLcjs = require('./chunk-4OSOLDPL.cjs');
7
+ require('./chunk-WBTHHTBO.cjs');
8
+ require('./chunk-CCAUIBIS.cjs');
9
+ require('./chunk-BIF5MLTH.cjs');
10
+ require('./chunk-BTZ5O6VM.cjs');
11
+
12
+
13
+
14
+
15
+
16
+ exports.CORE_PORTABLE = _chunk4OSOLDPLcjs.CORE_PORTABLE; exports.analyzeFarmMobileRoutes = _chunk4OSOLDPLcjs.analyzeFarmMobileRoutes; exports.readAliases = _chunk4OSOLDPLcjs.readAliases; exports.resolveFile = _chunk4OSOLDPLcjs.resolveFile;
@@ -4,7 +4,7 @@ import {
4
4
  parseFarmNativeStylesheet,
5
5
  resolveFarmNativeClasses,
6
6
  resolveFarmNativeInlineStyle
7
- } from "./chunk-JCEFKP5M.mjs";
7
+ } from "./chunk-423SSBYQ.mjs";
8
8
  import {
9
9
  FARM_NATIVE_TREE_CONTENT_TYPE
10
10
  } from "./chunk-LLZSYFOM.mjs";
@@ -26,12 +26,16 @@ var VOID_TAGS = new Set(
26
26
  "area base br col embed hr img input link meta source track wbr".split(" ")
27
27
  );
28
28
  var SKIPPED_TAGS = new Set("link meta template title".split(" "));
29
+ var TABLE_GROUP_TAGS = new Set("table thead tbody tfoot".split(" "));
30
+ var TABLE_CELL_TAGS = new Set("th td".split(" "));
29
31
  var INLINE_DEFAULTS = {
30
32
  strong: { fontWeight: 700 },
31
33
  b: { fontWeight: 700 },
32
34
  em: { fontStyle: "italic" },
33
35
  i: { fontStyle: "italic" },
34
- code: { fontFamily: "mono" }
36
+ code: { fontFamily: "mono" },
37
+ th: { fontWeight: 700, textAlign: "center" },
38
+ caption: { textAlign: "center" }
35
39
  };
36
40
  var ENTITIES = {
37
41
  amp: "&",
@@ -369,6 +373,52 @@ var Converter = class {
369
373
  else node.submit = this.submitter(element);
370
374
  return node;
371
375
  }
376
+ /**
377
+ * A table as native views: the table and its row groups are columns, a row is a row, and its
378
+ * cells share the row's width, `colspan` cells a wider share, so columns line up from row to row
379
+ * (as `table-layout: fixed` lays them out). A cell's content draws as any block content does.
380
+ */
381
+ tablePart(element, passed, box, boxDark, flex) {
382
+ const { tag } = element;
383
+ if (TABLE_CELL_TAGS.has(tag)) {
384
+ if (element.parent?.tag !== "tr") this.problem(`<${tag}> outside a row`);
385
+ const rowspan = Number(element.attributes.rowspan ?? 1);
386
+ if (rowspan !== 1) this.problem(`<${tag}> rowspan="${element.attributes.rowspan}"`);
387
+ const colspan = Number(element.attributes.colspan ?? 1);
388
+ const share = Number.isInteger(colspan) && colspan >= 1 ? colspan : 1;
389
+ const cell = box?.width !== void 0 ? { flexGrow: 0, flexShrink: 0, ...box } : { flexGrow: share, flexShrink: 1, flexBasis: 0, ...box };
390
+ const node2 = this.node("View", element, cell, boxDark);
391
+ const children2 = this.blocks(element.children, passed, flex);
392
+ if (children2.length > 0) node2.children = children2;
393
+ return node2;
394
+ }
395
+ const row = tag === "tr";
396
+ const node = this.node("View", element, row ? { ...box, flexDirection: "row" } : box, boxDark);
397
+ const children = [];
398
+ for (const child of element.children) {
399
+ if (typeof child === "string") {
400
+ if (child.trim()) this.problem(`text directly inside <${tag}>`);
401
+ continue;
402
+ }
403
+ if (child.tag === "colgroup" || child.tag === "col") {
404
+ for (const column of [child, ...child.children]) {
405
+ if (typeof column === "string") continue;
406
+ const { width, style, class: className } = column.attributes;
407
+ if (width || style || className) this.problem(`<${column.tag}> sets column styles`);
408
+ }
409
+ continue;
410
+ }
411
+ const allowed = row ? TABLE_CELL_TAGS.has(child.tag) : child.tag === "tr" || tag === "table" && (TABLE_GROUP_TAGS.has(child.tag) || child.tag === "caption");
412
+ if (!allowed && !SKIPPED_TAGS.has(child.tag)) {
413
+ this.problem(`<${child.tag}> inside <${tag}>`);
414
+ continue;
415
+ }
416
+ const part = this.element(child, passed);
417
+ if (part) children.push(part);
418
+ }
419
+ if (children.length > 0) node.children = children;
420
+ return node;
421
+ }
372
422
  element(element, inherited, flexItem = false) {
373
423
  if (SKIPPED_TAGS.has(element.tag)) return void 0;
374
424
  if (element.attributes.form !== void 0 && CONTROL_TAGS.has(element.tag)) {
@@ -408,7 +458,7 @@ var Converter = class {
408
458
  return node;
409
459
  }
410
460
  const textBox = flexItem && INLINE_TAGS.has(element.tag) && element.tag !== "a" && element.tag !== "br";
411
- if (BLOCK_TEXT_TAGS.has(element.tag) || textBox) {
461
+ if (BLOCK_TEXT_TAGS.has(element.tag) || element.tag === "caption" || textBox) {
412
462
  if (element.children.some((child) => typeof child !== "string" && !INLINE_TAGS.has(child.tag))) {
413
463
  this.problem(`<${element.tag}> holds block elements`);
414
464
  }
@@ -507,6 +557,9 @@ var Converter = class {
507
557
  boxDark
508
558
  );
509
559
  }
560
+ if (TABLE_GROUP_TAGS.has(element.tag) || element.tag === "tr" || TABLE_CELL_TAGS.has(element.tag)) {
561
+ return this.tablePart(element, passed, box, boxDark, flex);
562
+ }
510
563
  if (VIEW_TAGS.has(element.tag)) {
511
564
  const node = this.node("View", element, box, boxDark);
512
565
  const children = this.blocks(element.children, passed, flex);
@@ -653,6 +706,7 @@ async function createFarmNativeTreeResponse(options) {
653
706
  const headers = new Headers(options.request.headers);
654
707
  headers.set("accept", "text/html");
655
708
  headers.delete("accept-encoding");
709
+ headers.set("x-farm-native-tree", "1");
656
710
  const submitted = options.request.method === "POST";
657
711
  const init = submitted ? { method: "POST", headers, body: options.request.body, duplex: "half" } : { method: "GET", headers };
658
712
  const page = await options.renderPage(
@@ -663,10 +717,11 @@ async function createFarmNativeTreeResponse(options) {
663
717
  const drawn = page.status === 200 || submitted && page.status >= 400 && page.status < 500;
664
718
  if (!drawn || !type.includes("text/html")) return page;
665
719
  const html = await page.text();
666
- const pageUrl = new URL(options.request.url);
720
+ const requestUrl = new URL(options.request.url);
721
+ const pageUrl = options.origin ? new URL(requestUrl.pathname + requestUrl.search, options.origin) : requestUrl;
667
722
  const load = options.loadStylesheet ?? (async (href) => {
668
723
  const response = await options.renderPage(
669
- new Request(new URL(href, pageUrl), {
724
+ new Request(new URL(href, requestUrl), {
670
725
  headers: { accept: "text/css,*/*;q=0.1", cookie: headers.get("cookie") ?? "" },
671
726
  signal: options.request.signal
672
727
  })
@@ -448,6 +448,9 @@ function utility(token) {
448
448
  case "shrink-0":
449
449
  return { flexShrink: 0 };
450
450
  case "flex-nowrap":
451
+ case "table-auto":
452
+ case "table-fixed":
453
+ case "border-collapse":
451
454
  return {};
452
455
  case "flex-wrap":
453
456
  return { flexWrap: "wrap" };
@@ -746,6 +749,9 @@ function cssColor(value) {
746
749
  return `#${hex}${Math.round(Math.min(1, alpha) * 255).toString(16).padStart(2, "0")}`;
747
750
  }
748
751
  var IGNORED_PROPERTIES = /* @__PURE__ */ new Set([
752
+ // A native table always lays out like `table-layout: fixed`, its cells' borders side by side.
753
+ "border-collapse",
754
+ "table-layout",
749
755
  // No effect on a static, touch-only screen, or the shell owns it.
750
756
  "cursor",
751
757
  "outline",
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-MESQF2JC.mjs";
5
5
  import {
6
6
  normalizeFarmProductionSiteOrigin
7
- } from "./chunk-SNFTMSHX.mjs";
7
+ } from "./chunk-WVYRLP5E.mjs";
8
8
  import {
9
9
  resolveFarmAppManifestConfig
10
10
  } from "./chunk-SQ5O7I3L.mjs";
@@ -29,7 +29,7 @@ import {
29
29
  } from "./chunk-QDWMCFTH.mjs";
30
30
  import {
31
31
  FARM_VERSION
32
- } from "./chunk-LQDLEWPO.mjs";
32
+ } from "./chunk-MPIGW42F.mjs";
33
33
  import {
34
34
  applyFarmBasePath
35
35
  } from "./chunk-SF3JB56B.mjs";