@stacksjs/stx 0.2.421 → 0.2.423

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 (251) hide show
  1. package/dist/{chunk-ep5jnqdb.js → chunk-02n071n7.js} +6 -6
  2. package/dist/chunk-03n23sh6.js +2 -0
  3. package/dist/chunk-07mxghsz.js +2 -0
  4. package/dist/{chunk-kjkwycce.js → chunk-0bmc75w6.js} +4 -4
  5. package/dist/{chunk-hyak4dzg.js → chunk-0hhq9hbq.js} +3 -3
  6. package/dist/{chunk-66k7yxnr.js → chunk-12pvnn1e.js} +4 -4
  7. package/dist/chunk-1497wcxc.js +2 -0
  8. package/dist/chunk-17n9e5wk.js +2 -0
  9. package/dist/chunk-1p8hc1ve.js +2 -0
  10. package/dist/chunk-1r3ghgsz.js +2 -0
  11. package/dist/{chunk-r8wze9ym.js → chunk-24e7qjb8.js} +2 -2
  12. package/dist/chunk-259ecbwa.js +2 -0
  13. package/dist/chunk-26gfsa9w.js +2 -0
  14. package/dist/{chunk-3ynkg5dz.js → chunk-2bpjq1qz.js} +2 -2
  15. package/dist/{chunk-11ra3sbc.js → chunk-2x9jd5w0.js} +3 -3
  16. package/dist/{chunk-k31fwm2w.js → chunk-3hmy75tw.js} +5 -5
  17. package/dist/{chunk-12b8akfg.js → chunk-3pxp0r0a.js} +3 -3
  18. package/dist/{chunk-x5ks23vx.js → chunk-3ry9ca1s.js} +2 -2
  19. package/dist/{chunk-th9s15es.js → chunk-45rfv3a5.js} +2 -2
  20. package/dist/chunk-47apfsxp.js +2 -0
  21. package/dist/{chunk-ax58cds3.js → chunk-48kgnqpk.js} +4 -4
  22. package/dist/{chunk-rsxvbnp4.js → chunk-4hd5wb8x.js} +3 -3
  23. package/dist/chunk-535nrr6j.js +2 -0
  24. package/dist/chunk-5mfhk69g.js +2 -0
  25. package/dist/{chunk-aync8qmk.js → chunk-5vwg3h5g.js} +2 -2
  26. package/dist/{chunk-tspmynvh.js → chunk-62chbqev.js} +1 -1
  27. package/dist/chunk-6c7294j8.js +2 -0
  28. package/dist/{chunk-z0ck9t6j.js → chunk-6cbvx87h.js} +5 -5
  29. package/dist/{chunk-kea18wnc.js → chunk-6fsbny9m.js} +3 -3
  30. package/dist/chunk-6gh2rvyz.js +2 -0
  31. package/dist/chunk-6j6gbp0y.js +2 -0
  32. package/dist/chunk-6jgjmycb.js +2 -0
  33. package/dist/{chunk-hjp990p8.js → chunk-6t278w29.js} +2 -2
  34. package/dist/{chunk-5vfyxxrp.js → chunk-6t7mxb0b.js} +2 -2
  35. package/dist/chunk-6wmxrn6x.js +2 -0
  36. package/dist/chunk-6wweqfg7.js +2 -0
  37. package/dist/{chunk-h1h6xe1k.js → chunk-7a9h7ycs.js} +5 -5
  38. package/dist/chunk-7pbv9mg7.js +2 -0
  39. package/dist/{chunk-09hhrjk9.js → chunk-89b2r1q0.js} +6 -6
  40. package/dist/{chunk-0varh725.js → chunk-8a0r2j8f.js} +3 -3
  41. package/dist/{chunk-pzngjk81.js → chunk-8nsbf2mz.js} +1074 -1074
  42. package/dist/{chunk-mg13q1kd.js → chunk-8zf5q1m3.js} +2 -2
  43. package/dist/chunk-9d53d0t6.js +2 -0
  44. package/dist/chunk-9j72har9.js +2 -0
  45. package/dist/chunk-9yqz5ge5.js +2 -0
  46. package/dist/chunk-a5c9n7an.js +2 -0
  47. package/dist/chunk-a836zn7c.js +2 -0
  48. package/dist/{chunk-8vq0qjq9.js → chunk-a8g6y9kw.js} +5 -5
  49. package/dist/{chunk-21a7p956.js → chunk-acwgap78.js} +1 -1
  50. package/dist/{chunk-qx3js9tk.js → chunk-aen2baze.js} +1 -1
  51. package/dist/chunk-ahgrkva8.js +2 -0
  52. package/dist/chunk-akbb6j7s.js +2 -0
  53. package/dist/chunk-avakcrbs.js +2 -0
  54. package/dist/{chunk-tafebmtg.js → chunk-axydabse.js} +2 -2
  55. package/dist/{chunk-4n6c5rp5.js → chunk-b7973zvk.js} +2 -2
  56. package/dist/{chunk-debz86rr.js → chunk-bxwe7wxj.js} +10 -10
  57. package/dist/{chunk-2ewa2sg5.js → chunk-c1dmr865.js} +3 -3
  58. package/dist/chunk-cenq2n6e.js +2 -0
  59. package/dist/{chunk-zvh2nnzr.js → chunk-cf6htz63.js} +1 -1
  60. package/dist/chunk-cnmz9543.js +2 -0
  61. package/dist/{chunk-bh4x090w.js → chunk-cx2rdew4.js} +13 -13
  62. package/dist/{chunk-wg1ttvs5.js → chunk-cznsm2n3.js} +2 -2
  63. package/dist/chunk-d1qzhawc.js +2 -0
  64. package/dist/chunk-d6hnvwre.js +2 -0
  65. package/dist/{chunk-014gmm8w.js → chunk-dcwjxq8n.js} +2 -2
  66. package/dist/chunk-dhqwg62x.js +2 -0
  67. package/dist/{chunk-z521cyfv.js → chunk-dmd6yk2x.js} +5 -5
  68. package/dist/chunk-e18qfegt.js +2 -0
  69. package/dist/chunk-eej89wkt.js +2 -0
  70. package/dist/chunk-ekxffxbd.js +2 -0
  71. package/dist/{chunk-hy9e3ny6.js → chunk-ex0tq6x2.js} +1 -1
  72. package/dist/{chunk-8drvzsk1.js → chunk-fg5ve6ey.js} +2 -2
  73. package/dist/{chunk-3kmhv1kf.js → chunk-fnt1q1sp.js} +11 -11
  74. package/dist/chunk-g67gg66e.js +2 -0
  75. package/dist/chunk-gq16fxc2.js +2 -0
  76. package/dist/{chunk-4e101kjp.js → chunk-h3c7z73m.js} +2 -2
  77. package/dist/chunk-h4avjh3q.js +2 -0
  78. package/dist/chunk-h7qte7ye.js +2 -0
  79. package/dist/{chunk-4mew0ae3.js → chunk-hb9gxad0.js} +3 -3
  80. package/dist/{chunk-0y7x0hvr.js → chunk-hg4k3nkr.js} +1 -1
  81. package/dist/{chunk-dhxbjw6k.js → chunk-hnep9jbj.js} +2 -2
  82. package/dist/chunk-hwycbxg7.js +2 -0
  83. package/dist/{chunk-34gy5zjm.js → chunk-j1q65enz.js} +2 -2
  84. package/dist/chunk-j5myfxe8.js +18 -0
  85. package/dist/{chunk-8jqy69td.js → chunk-j7zywbq0.js} +2 -2
  86. package/dist/{chunk-32y3767j.js → chunk-jbrdebzs.js} +7 -7
  87. package/dist/{chunk-1336h4sv.js → chunk-jj4pyeyj.js} +1 -1
  88. package/dist/{chunk-g1fxmp9z.js → chunk-k8sqs7j2.js} +4 -4
  89. package/dist/chunk-mg7jhx5v.js +2 -0
  90. package/dist/chunk-n16wa755.js +2 -0
  91. package/dist/chunk-ngv1c807.js +2 -0
  92. package/dist/{chunk-krr2vb0s.js → chunk-p2x7tjbt.js} +3 -3
  93. package/dist/{chunk-62r4fa4q.js → chunk-ptjqacjd.js} +2 -2
  94. package/dist/{chunk-rj3hyqff.js → chunk-qm1tt8g1.js} +2334 -2334
  95. package/dist/chunk-r7r5h2eh.js +2 -0
  96. package/dist/chunk-rhkx17d9.js +2 -0
  97. package/dist/{chunk-b1fg9vg7.js → chunk-s28eh0jn.js} +2 -2
  98. package/dist/{chunk-10967rws.js → chunk-s295vp9x.js} +3 -3
  99. package/dist/chunk-sazpw71r.js +4 -0
  100. package/dist/{chunk-20tdz0zs.js → chunk-sbdzqqr1.js} +6 -6
  101. package/dist/{chunk-qby6wxat.js → chunk-spx27cs4.js} +2 -2
  102. package/dist/{chunk-m16h8ea0.js → chunk-stxmwytg.js} +2 -2
  103. package/dist/{chunk-2tfe2g58.js → chunk-t3wh1jbk.js} +6 -6
  104. package/dist/{chunk-802pr252.js → chunk-tfexmdkt.js} +2 -2
  105. package/dist/{chunk-6aqcgrhw.js → chunk-tfz95n7j.js} +5 -5
  106. package/dist/chunk-thdbqsxq.js +2 -0
  107. package/dist/chunk-tpnfcb83.js +2 -0
  108. package/dist/chunk-tqkv4th9.js +2 -0
  109. package/dist/chunk-tznejj9h.js +2 -0
  110. package/dist/{chunk-ap6fehea.js → chunk-vfk725vm.js} +5 -5
  111. package/dist/chunk-vsrm9k7p.js +2 -0
  112. package/dist/chunk-vwms759h.js +2 -0
  113. package/dist/{chunk-xvzxrt9a.js → chunk-w2085fwx.js} +5 -5
  114. package/dist/chunk-w252cgnv.js +30 -0
  115. package/dist/chunk-whdw6dhb.js +2 -0
  116. package/dist/chunk-wtms9jhs.js +3 -0
  117. package/dist/chunk-wtqjfar3.js +2 -0
  118. package/dist/chunk-wx7kfet5.js +2 -0
  119. package/dist/chunk-wy873fy8.js +2 -0
  120. package/dist/{chunk-a4r19yxm.js → chunk-xa3wsmt5.js} +11 -11
  121. package/dist/chunk-xrbqf77j.js +2 -0
  122. package/dist/{chunk-757ec865.js → chunk-yaebdyfr.js} +2 -2
  123. package/dist/chunk-ycpq3gxc.js +2 -0
  124. package/dist/chunk-yd50awqp.js +3 -0
  125. package/dist/{chunk-csjw5esc.js → chunk-ydz7w2mt.js} +2 -2
  126. package/dist/chunk-yjgbxf26.js +2 -0
  127. package/dist/{chunk-jjnfj9nf.js → chunk-yqsza22w.js} +2 -2
  128. package/dist/{chunk-8j8k27xb.js → chunk-zbr333kf.js} +115 -31
  129. package/dist/chunk-zcyjdcpx.js +33 -0
  130. package/dist/{chunk-tqnysw0k.js → chunk-zfzcedw4.js} +4 -4
  131. package/dist/chunk-zm73n103.js +2 -0
  132. package/dist/cli.js +21 -21
  133. package/dist/component-renderer.js +54 -2
  134. package/dist/composables/use-outbox.d.ts +1 -0
  135. package/dist/composables/use-outbox.js +14 -4
  136. package/dist/craft-entry.js +2 -2
  137. package/dist/craft.js +2 -2
  138. package/dist/database.js +2 -2
  139. package/dist/native/bridge/protocol.d.ts +5 -0
  140. package/dist/native/bridge/protocol.js +3 -0
  141. package/dist/native/cli.js +12 -2
  142. package/dist/native/compiler/bundle.d.ts +4 -3
  143. package/dist/native/compiler/bundle.js +46 -51
  144. package/dist/native/compiler/component-mapping.d.ts +5 -0
  145. package/dist/native/compiler/component-mapping.js +90 -0
  146. package/dist/native/compiler/html-to-ir.js +42 -6
  147. package/dist/native/compiler/ir.d.ts +2 -0
  148. package/dist/native/compiler/render-screen.d.ts +4 -0
  149. package/dist/native/compiler/render-screen.js +10 -2
  150. package/dist/native/compiler/setup-script.d.ts +6 -0
  151. package/dist/native/compiler/setup-script.js +10 -0
  152. package/dist/native/components/primitives.d.ts +10 -0
  153. package/dist/native/index.d.ts +6 -24
  154. package/dist/native/index.js +1 -17
  155. package/dist/native/primitives/Button.stx +2 -1
  156. package/dist/native/primitives/Text.stx +2 -1
  157. package/dist/native/primitives/TextInput.stx +3 -1
  158. package/dist/native/prop-names.d.ts +2 -0
  159. package/dist/native/prop-names.js +71 -0
  160. package/dist/native/runtime/binding-tree.d.ts +31 -0
  161. package/dist/native/runtime/binding-tree.js +100 -0
  162. package/dist/native/runtime/craft-bridge.d.ts +9 -0
  163. package/dist/native/runtime/craft-bridge.js +231 -0
  164. package/dist/native/runtime/craft.d.ts +28 -3
  165. package/dist/native/runtime/jsc-globals.d.ts +16 -0
  166. package/dist/native/runtime/jsc-globals.js +64 -0
  167. package/dist/native/runtime/native-host.d.ts +3 -1
  168. package/dist/native/runtime/native-host.js +183 -33
  169. package/dist/native/runtime/shared-screen.d.ts +15 -0
  170. package/dist/native/runtime/shared-screen.js +41 -0
  171. package/dist/pwa.js +3 -3
  172. package/dist/signal-processing.d.ts +3 -1
  173. package/dist/signal-processing.js +4 -3
  174. package/dist/signals.js +104 -20
  175. package/dist/ssg.js +28 -28
  176. package/dist/variable-extractor.js +4 -1
  177. package/package.json +5 -5
  178. package/dist/chunk-0n76c3g8.js +0 -2
  179. package/dist/chunk-10fh9qhe.js +0 -2
  180. package/dist/chunk-18awnp9d.js +0 -2
  181. package/dist/chunk-2hswgxpb.js +0 -2
  182. package/dist/chunk-3zye6eh1.js +0 -2
  183. package/dist/chunk-4488r5j1.js +0 -2
  184. package/dist/chunk-4amznxaq.js +0 -2
  185. package/dist/chunk-5akd7qsb.js +0 -2
  186. package/dist/chunk-5eqd40k0.js +0 -2
  187. package/dist/chunk-6r9y4p81.js +0 -2
  188. package/dist/chunk-75zcwcrt.js +0 -2
  189. package/dist/chunk-89e1d0rz.js +0 -4
  190. package/dist/chunk-8nsqac4z.js +0 -2
  191. package/dist/chunk-8ttvazck.js +0 -2
  192. package/dist/chunk-8y4bqsxz.js +0 -2
  193. package/dist/chunk-ac033b93.js +0 -2
  194. package/dist/chunk-aj43359g.js +0 -2
  195. package/dist/chunk-aj8yq228.js +0 -2
  196. package/dist/chunk-as72dvvm.js +0 -2
  197. package/dist/chunk-awtrcb5m.js +0 -18
  198. package/dist/chunk-b01jqb5f.js +0 -2
  199. package/dist/chunk-b7z2yegr.js +0 -2
  200. package/dist/chunk-bfvaxrq0.js +0 -2
  201. package/dist/chunk-bkaw7sgz.js +0 -2
  202. package/dist/chunk-bmk0s261.js +0 -2
  203. package/dist/chunk-bvbank3z.js +0 -2
  204. package/dist/chunk-cvzkbsds.js +0 -2
  205. package/dist/chunk-cw6j75ck.js +0 -30
  206. package/dist/chunk-d2c5727w.js +0 -2
  207. package/dist/chunk-d5amzers.js +0 -2
  208. package/dist/chunk-dfchrqw5.js +0 -2
  209. package/dist/chunk-dscsvkfa.js +0 -2
  210. package/dist/chunk-eav0pt6d.js +0 -2
  211. package/dist/chunk-hahzjyxc.js +0 -2
  212. package/dist/chunk-hgqcqg1h.js +0 -2
  213. package/dist/chunk-hjdwf9gp.js +0 -2
  214. package/dist/chunk-jjm0ekw8.js +0 -2
  215. package/dist/chunk-jjtzm6dn.js +0 -3
  216. package/dist/chunk-k1am0dyg.js +0 -2
  217. package/dist/chunk-m2jphkdv.js +0 -2
  218. package/dist/chunk-mk7b3qdz.js +0 -2
  219. package/dist/chunk-ncvfjcr2.js +0 -2
  220. package/dist/chunk-p083sckk.js +0 -2
  221. package/dist/chunk-p7b17yr0.js +0 -2
  222. package/dist/chunk-pc178389.js +0 -2
  223. package/dist/chunk-q1v0jwr4.js +0 -2
  224. package/dist/chunk-r5gjb55x.js +0 -2
  225. package/dist/chunk-rj8rdd8n.js +0 -2
  226. package/dist/chunk-s0pmn48x.js +0 -2
  227. package/dist/chunk-s58yz9q0.js +0 -2
  228. package/dist/chunk-srdzwtsq.js +0 -2
  229. package/dist/chunk-tf44jyrh.js +0 -2
  230. package/dist/chunk-tfypkw4y.js +0 -3
  231. package/dist/chunk-vwxasbtx.js +0 -2
  232. package/dist/chunk-wynvh7dc.js +0 -2
  233. package/dist/chunk-x8rckpyz.js +0 -2
  234. package/dist/chunk-y4xs4m7p.js +0 -2
  235. package/dist/chunk-y8rpk1b9.js +0 -2
  236. package/dist/chunk-y9m93qkk.js +0 -2
  237. package/dist/chunk-ya0qecph.js +0 -27
  238. package/dist/chunk-ya9c8nec.js +0 -2
  239. package/dist/chunk-yvq1f313.js +0 -2
  240. package/dist/chunk-yy3dgwfm.js +0 -2
  241. package/dist/chunk-zpcz2kh6.js +0 -2
  242. package/dist/native/compiler/codegen.d.ts +0 -10
  243. package/dist/native/compiler/codegen.js +0 -145
  244. package/dist/native/compiler/parser.d.ts +0 -88
  245. package/dist/native/compiler/parser.js +0 -753
  246. package/dist/native/runtime/entry.d.ts +0 -1
  247. package/dist/native/runtime/entry.js +0 -3
  248. package/dist/native/runtime/index.d.ts +0 -45
  249. package/dist/native/runtime/index.js +0 -165
  250. package/dist/native/runtime/screen.d.ts +0 -43
  251. package/dist/native/runtime/screen.js +0 -808
package/dist/signals.js CHANGED
@@ -81,8 +81,19 @@ console.log('[stx] entering IIFE');
81
81
  // exactly as it was: same calls, one property lookup earlier.
82
82
  var stxHost = window.__stx_host || {
83
83
  setText: function(node, value) { node.textContent = value; },
84
- setAttribute: function(node, name, value) { node.setAttribute(name, value); },
84
+ setAttribute: function(node, name, value) {
85
+ var next = value;
86
+ if (typeof value === 'object' && value !== null) {
87
+ try { next = JSON.stringify(value); }
88
+ catch (e) { next = String(value); }
89
+ }
90
+ node.setAttribute(name, next);
91
+ },
85
92
  removeAttribute: function(node, name) { node.removeAttribute(name); },
93
+ setStyle: function(node, value) {
94
+ if (typeof value === 'object' && value !== null) Object.assign(node.style, value);
95
+ else if (typeof value === 'string') node.style.cssText = value;
96
+ },
86
97
 
87
98
  // Structural operations, for the bindings that build rows rather than
88
99
  // update one node (#1984).
@@ -2842,21 +2853,72 @@ catch (e) {
2842
2853
  * Absent a manifest nothing changes: the walk is still the default, and a
2843
2854
  * page that ships no list hydrates exactly as it did.
2844
2855
  */
2845
- function processFromManifest(root, scope, manifest) {
2846
- if (!root || !manifest || !manifest.length) return false;
2847
- for (var i = 0; i < manifest.length; i++) {
2848
- var entry = manifest[i];
2856
+ function processFromManifest(root, scope, manifest, resolvedNodes) {
2857
+ // Arrays have an entries() method too. Prefer the array itself before
2858
+ // accepting the compiled document shape { entries: [...] }.
2859
+ var entries = Array.isArray(manifest)
2860
+ ? manifest
2861
+ : (manifest && Array.isArray(manifest.entries) ? manifest.entries : null);
2862
+ if (!entries || !entries.length || (!root && !resolvedNodes)) return false;
2863
+ for (var i = 0; i < entries.length; i++) {
2864
+ var entry = entries[i];
2849
2865
  var id = entry && entry.id;
2850
2866
  if (id === undefined || id === null) continue;
2851
- var node = root.getAttribute && root.getAttribute('data-stx-b') === String(id)
2852
- ? root
2853
- : (root.querySelector ? root.querySelector('[data-stx-b="' + id + '"]') : null);
2867
+ // Native compilation already has stable handles for every manifest id.
2868
+ // Accept those handles directly so a non-DOM host never needs selectors
2869
+ // or an attribute walk. The browser keeps its existing lookup fallback.
2870
+ var node = resolvedNodes
2871
+ ? (typeof resolvedNodes.get === 'function' ? resolvedNodes.get(id) : resolvedNodes[id])
2872
+ : null;
2873
+ if (!node && root) {
2874
+ node = root.getAttribute && root.getAttribute('data-stx-b') === String(id)
2875
+ ? root
2876
+ : (root.querySelector ? root.querySelector('[data-stx-b="' + id + '"]') : null);
2877
+ }
2854
2878
  if (!node) continue;
2879
+ // A structural binding can detach its source before a later manifest
2880
+ // entry reaches one of that source's children. Native handles expose
2881
+ // this state directly; do not register effects or handlers for a view
2882
+ // that no longer exists in the host tree. Browser hydration keeps its
2883
+ // existing behaviour because it does not pass resolvedNodes here.
2884
+ if (resolvedNodes && node.__stxId !== undefined && node.isConnected === false) continue;
2855
2885
  processElement(node, scope, true);
2856
2886
  }
2857
2887
  return true;
2858
2888
  }
2859
2889
 
2890
+ // Bind a precompiled host tree without waiting for DOMContentLoaded. Native
2891
+ // passes its manifest id to node-handle table; browser hydration continues
2892
+ // through the document-ready path below. The same state, effect, expression,
2893
+ // event and host implementations are used by both.
2894
+ function hydrateHost(root, setup, manifest, resolvedNodes) {
2895
+ var mountStart = mountCallbacks.length;
2896
+ var destroyStart = destroyCallbacks.length;
2897
+ var outerSink = activeDestroySink;
2898
+ activeDestroySink = null;
2899
+ var values;
2900
+ try { values = typeof setup === 'function' ? setup() : setup; }
2901
+ finally { activeDestroySink = outerSink; }
2902
+ var localMountHooks = mountCallbacks.splice(mountStart);
2903
+ var localDestroyHooks = destroyCallbacks.splice(destroyStart);
2904
+ var scope = Object.assign({ $refs: {} }, values || {});
2905
+ var disposeEffects = trackEffects(function() {
2906
+ processFromManifest(root, scope, manifest, resolvedNodes);
2907
+ });
2908
+ runMountCallbacks(localMountHooks, localDestroyHooks);
2909
+ var mounted = true;
2910
+ return function disposeHost() {
2911
+ if (!mounted) return;
2912
+ mounted = false;
2913
+ disposeEffects();
2914
+ var hooks = localDestroyHooks.splice(0, localDestroyHooks.length);
2915
+ for (var i = 0; i < hooks.length; i++) {
2916
+ try { hooks[i](); }
2917
+ catch (e) { console.warn('[stx] native destroy error:', e); }
2918
+ }
2919
+ };
2920
+ }
2921
+
2860
2922
  // skipChildren: this element's bindings only, because something else already
2861
2923
  // knows where the rest are. The manifest path passes it for every entry, so
2862
2924
  // the tree is never walked; see processFromManifest.
@@ -3047,6 +3109,19 @@ else if (part) {
3047
3109
  // Use the passed scope parameter to preserve context through nested processing
3048
3110
  const attrCapturedScope = { ...globalHelpers, ...scope, ...(findElementScope(el) || {}) };
3049
3111
 
3112
+ // Keep the conditional owners captured while the element is in the tree.
3113
+ // Walking parents on each update loses an outer owner when an inner :if
3114
+ // detaches its own root. These signals suspend writes while either owner
3115
+ // is hidden and refresh the latest value AFTER reinsertion, even when the
3116
+ // attribute's source did not change on that show.
3117
+ const attrVisibility = [];
3118
+ for (var attrAncestor = el; attrAncestor; attrAncestor = attrAncestor.parentNode) {
3119
+ if (attrAncestor.__stx_if_visible) attrVisibility.push(attrAncestor.__stx_if_visible);
3120
+ }
3121
+ function attributesVisible() {
3122
+ return attrVisibility.every(function(visible) { return visible(); });
3123
+ }
3124
+
3050
3125
  // Post-eval unwrap: if the expression result is a signal function (e.g.
3051
3126
  // step was resolved via identifier lookup, not via the auto-unwrap
3052
3127
  // proxy \u2014 happens when a client script declares const step = state(...)
@@ -3188,6 +3263,7 @@ catch (e2) {
3188
3263
  ? el.__stx_parent_scope
3189
3264
  : attrCapturedScope;
3190
3265
  effect(() => {
3266
+ if (!attributesVisible()) return;
3191
3267
  const v = evalAttrExpr(value, bindingScope);
3192
3268
  // Form control values are live DOM properties. Setting only the HTML
3193
3269
  // attribute does not update a <select>'s chosen option and can leave
@@ -3201,6 +3277,7 @@ catch (e2) {
3201
3277
  controlValue = v === false || v === null || v === undefined ? '' : String(controlValue);
3202
3278
  el.__stx_bound_value = controlValue;
3203
3279
  var applyControlValue = function() {
3280
+ if (!attributesVisible()) return;
3204
3281
  var desiredValue = el.__stx_bound_value == null ? '' : String(el.__stx_bound_value);
3205
3282
  el.value = desiredValue;
3206
3283
  if (desiredValue === '' && el.tagName !== 'OPTION') el.removeAttribute(attrName);
@@ -3264,6 +3341,9 @@ else {
3264
3341
  catch (e) { attrValue = String(v); }
3265
3342
  }
3266
3343
  var attrValueSafe = safeUrlAttr(attrName, attrValue);
3344
+ // Keep structured values structured for non-DOM hosts. The DOM
3345
+ // host serializes them at its boundary, preserving web output.
3346
+ var hostValue = (typeof v === 'object' && v !== null) ? v : attrValueSafe;
3267
3347
  // Writing the value an attribute already has is not nothing: a
3268
3348
  // frame given its own src again loads again (an entry in the
3269
3349
  // page's history each time) and a video restarts. A player whose
@@ -3280,22 +3360,22 @@ else {
3280
3360
  && el.hasAttribute('src') && el.getAttribute('src') !== String(attrValueSafe)) {
3281
3361
  var nextSibling = el.nextSibling;
3282
3362
  parentNode.removeChild(el);
3283
- stxHost.setAttribute(el, attrName, attrValueSafe);
3363
+ stxHost.setAttribute(el, attrName, hostValue);
3284
3364
  parentNode.insertBefore(el, nextSibling);
3285
3365
  }
3286
3366
  else {
3287
- stxHost.setAttribute(el, attrName, attrValueSafe);
3367
+ stxHost.setAttribute(el, attrName, hostValue);
3288
3368
  }
3289
3369
  }
3290
3370
  });
3291
3371
  el.removeAttribute(name);
3292
3372
  }
3293
3373
  else if (name === '@class' || name === ':class' || name === 'x-class') {
3294
- bindClass(el, value, scope);
3374
+ bindClass(el, value, scope, attributesVisible);
3295
3375
  el.removeAttribute(name);
3296
3376
  }
3297
3377
  else if (name === '@style' || name === ':style' || name === 'x-style') {
3298
- bindStyle(el, value, scope);
3378
+ bindStyle(el, value, scope, attributesVisible);
3299
3379
  el.removeAttribute(name);
3300
3380
  }
3301
3381
  else if (name === '@text' || name === ':text' || name === 'x-text') {
@@ -3781,7 +3861,7 @@ else {
3781
3861
  el.removeAttribute(attrName);
3782
3862
  }
3783
3863
 
3784
- function bindClass(el, expr, passedScope = componentScope) {
3864
+ function bindClass(el, expr, passedScope = componentScope, isVisible) {
3785
3865
  const originalClasses = el.className;
3786
3866
  const capturedScope = { ...globalHelpers, ...passedScope, ...(findElementScope(el) || {}) };
3787
3867
  const keys = Object.keys(capturedScope);
@@ -3800,6 +3880,7 @@ else {
3800
3880
  }
3801
3881
 
3802
3882
  effect(() => {
3883
+ if (isVisible && !isVisible()) return;
3803
3884
  // Subscribe to signals by reading them, establishing reactive deps.
3804
3885
  // But pass RAW scope values to the fn so call-expressions like
3805
3886
  // activeTab() === 'overview' work \u2014 if we passed unwrapped values,
@@ -3849,7 +3930,7 @@ else {
3849
3930
  });
3850
3931
  }
3851
3932
 
3852
- function bindStyle(el, expr, passedScope = componentScope) {
3933
+ function bindStyle(el, expr, passedScope = componentScope, isVisible) {
3853
3934
  // Capture scope at setup time - use passed scope to preserve context
3854
3935
  const capturedScope = { ...globalHelpers, ...passedScope, ...(findElementScope(el) || {}) };
3855
3936
 
@@ -3878,13 +3959,9 @@ catch (e2) {
3878
3959
  };
3879
3960
 
3880
3961
  effect(() => {
3962
+ if (isVisible && !isVisible()) return;
3881
3963
  const value = evalExpr();
3882
- if (typeof value === 'object' && value !== null) {
3883
- Object.assign(el.style, value);
3884
- }
3885
- else if (typeof value === 'string') {
3886
- el.style.cssText = value;
3887
- }
3964
+ stxHost.setStyle(el, value);
3888
3965
  });
3889
3966
  }
3890
3967
 
@@ -4918,6 +4995,7 @@ catch (e) {
4918
4995
  b.el.__stx_if_bound = true;
4919
4996
  b.el.__stx_chain_member = true;
4920
4997
  b.el.__stx_chain_active = false;
4998
+ b.el.__stx_if_visible = state(false);
4921
4999
  b.capturedElementScope = findElementScope(b.el);
4922
5000
  b.placeholder = stxHost.anchor('stx-if-chain');
4923
5001
  stxHost.insert(parent, b.placeholder, b.el);
@@ -5037,6 +5115,7 @@ catch (e2) {
5037
5115
  if (currentIdx !== -1) {
5038
5116
  var gone = chain[currentIdx];
5039
5117
  gone.el.__stx_chain_active = false;
5118
+ gone.el.__stx_if_visible.set(false);
5040
5119
 
5041
5120
  if (gone.isTemplate) {
5042
5121
  // Everything this branch rendered goes, not just the clones it owns:
@@ -5097,6 +5176,7 @@ catch (e) { /* a disposer of its own is not this branch's problem */ }
5097
5176
  if (pickHost.__stx_detached_if) pickHost.__stx_detached_if.delete(n);
5098
5177
  stxHost.insert(pickHost, n, anchor);
5099
5178
  });
5179
+ pick.el.__stx_if_visible.set(true);
5100
5180
  // Bound AFTER the clones, so hiding can remove whatever a structural
5101
5181
  // directive inside the branch renders as their sibling.
5102
5182
  if (pick.isTemplate) {
@@ -5192,6 +5272,7 @@ catch (e) { /* a disposer of its own is not this branch's problem */ }
5192
5272
 
5193
5273
  // Handle <template> elements specially - clone their content
5194
5274
  const isTemplate = el.tagName === 'TEMPLATE';
5275
+ if (!isTemplate) el.__stx_if_visible = state(true);
5195
5276
  const componentSetupSiblings = isTemplate ? [] : findConditionalComponentSetupSiblings(el);
5196
5277
  let currentNodes = isTemplate ? [] : [el, ...componentSetupSiblings];
5197
5278
 
@@ -5362,11 +5443,13 @@ else {
5362
5443
  const insertionAnchor = placeholder.nextSibling;
5363
5444
  currentNodes.forEach(node => stxHost.insert(parent, node, insertionAnchor));
5364
5445
  if (parent && parent.__stx_detached_if) currentNodes.forEach(node => parent.__stx_detached_if.delete(node));
5446
+ el.__stx_if_visible.set(true);
5365
5447
  el.__stx_shown_at = performance.now();
5366
5448
  isInserted = true;
5367
5449
  }
5368
5450
  else if (!value && isInserted) {
5369
5451
  console.log('[stx] bindIf REMOVING element for :if=' + expr, 'el.isConnected:', el.isConnected, 'parent:', parent.tagName);
5452
+ el.__stx_if_visible.set(false);
5370
5453
  // Do NOT disposeSubtreeScopes here. :if is a TOGGLE \u2014 the element is
5371
5454
  // re-shown when the condition flips back \u2014 not a permanent unmount.
5372
5455
  // A nested data-stx-scope inside this subtree is created once by its
@@ -7346,6 +7429,7 @@ catch (e) {} }
7346
7429
  // calling a detached one.
7347
7430
  window.stx = Object.assign(window.stx || {}, {
7348
7431
  hydrate: hydrateSubtree,
7432
+ hydrateHost,
7349
7433
  state,
7350
7434
  derived,
7351
7435
  effect,
package/dist/ssg.js CHANGED
@@ -1,33 +1,33 @@
1
1
  // @bun
2
- import"./chunk-09hhrjk9.js";import"./chunk-x5ks23vx.js";import{Ze,Qe,et,tt,nt,rt}from"./chunk-66k7yxnr.js";import"./chunk-757ec865.js";import"./chunk-tafebmtg.js";import{f,Le,M,q,r,i}from"./chunk-rj3hyqff.js";import"./chunk-ax58cds3.js";import{Jn}from"./chunk-32y3767j.js";import"./chunk-62r4fa4q.js";import"./chunk-4e101kjp.js";import"./chunk-4n6c5rp5.js";import"./chunk-g1fxmp9z.js";import"./chunk-z0ck9t6j.js";import{oe,pt,ft}from"./chunk-6aqcgrhw.js";import{xi,Si,ki}from"./chunk-2ewa2sg5.js";import{ut,Kt,Xt}from"./chunk-jjtzm6dn.js";import"./chunk-11ra3sbc.js";import{a}from"./chunk-tfypkw4y.js";import x from"fs";import g from"path";import{createHash as Pt}from"crypto";function $t(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Dt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Rt(t){return Bun.hash(t).toString(16)}function ct(t,s={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let o=new Map,n=t.replace(Dt,(e,l,w,y)=>{let h=y.trim();if(!h)return e;if(/\bdata-stx-src=/.test(w))return e;if(s.minify)h=$t(h);let S=Rt(h);if(!o.has(S))o.set(S,h);let P=s.integrity?` data-stx-integrity="sha384-${Pt("sha384").update(h).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${l}" data-stx-src="/_stx/islands/${S}.js"${P}${w}></script>`}),c=Array.from(o,([e,l])=>({hash:e,code:l}));return{html:n,chunks:c}}var kt=new Set(["visible","idle"]);function lt(t){if(!t.includes("data-stx-src="))return t;let s=new Map,o=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,n;while((n=o.exec(t))!==null)s.set(n[1],n[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,l;while((l=e.exec(t))!==null)if(kt.has(s.get(l[1])||""))c.add(l[2]);let w=t.lastIndexOf("</head>");if(c.size===0||w===-1)return t;let y=Array.from(c).filter((h)=>!t.includes(`rel="prefetch" href="${h}"`)).map((h)=>`<link rel="prefetch" href="${h}" as="script">`).join("");if(!y)return t;return t.slice(0,w)+y+t.slice(w)}var Ct=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function J(t){let s=t.trim();if(!s)return null;let o=/^https?:\/\//i.test(s)?s:`https://${s}`;try{return new URL(o).origin+new URL(o).pathname.replace(/\/$/,"")}catch{return null}}function Et(t){for(let s of Ct){let o=t[s];if(!o)continue;let n=J(o);if(n)return{url:n,source:"env",via:s}}return null}function dt(t){if(!t||typeof t!=="object")return null;let s=t,o=s.site?.url??s.url??s.app?.url;return typeof o==="string"?J(o):null}async function It(t){let{existsSync:s}=await import("fs"),o=await import("path");for(let n of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=o.resolve(t,n);if(!s(c))continue;try{let e=await import(c),l=dt(e.default??e);if(l)return l}catch{}}return null}async function gt(t={}){let s=t.cwd??process.cwd(),o=t.env??process.env;if(t.explicit){let l=J(t.explicit);if(l)return{url:l,source:"option"}}let n=dt(t.stxConfig);if(n)return{url:n,source:"stx.config",via:"site.url"};let c=await It(s);if(c)return{url:c,source:"site.config",via:"url"};let e=Et(o);if(e)return e;return{url:"http://localhost",source:"fallback"}}function ht(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
3
- `)}class mt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,s=""){this.cacheDir=t,this.salt=s}async load(){if(this.loaded)return;let t=g.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let s=JSON.parse(await Bun.file(t).text());for(let[o,n]of Object.entries(s))this.cache.set(o,n)}catch{}this.loaded=!0}async save(){await x.promises.mkdir(this.cacheDir,{recursive:!0});let t=g.join(this.cacheDir,"build-cache.json"),s={};for(let[o,n]of this.cache)s[o]=n;await Bun.write(t,JSON.stringify(s))}getHash(t,s){let o=x.statSync(t),n=`${this.salt}|${t}:${o.mtimeMs}`;for(let e of s)if(x.existsSync(e)){let l=x.statSync(e);n+=`:${e}:${l.mtimeMs}`}let c=0;for(let e=0;e<n.length;e++){let l=n.charCodeAt(e);c=(c<<5)-c+l,c=c&c}return Math.abs(c).toString(36)}get(t,s){let o=this.cache.get(t);if(!o)return null;let n=this.getHash(s,o.dependencies??[]);if(o.hash!==n)return this.cache.delete(t),null;return o.html}set(t,s,o,n){let c=this.getHash(s,o);this.cache.set(t,{hash:c,html:n,generatedAt:Date.now(),dependencies:o})}}class wt{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let s=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return g.join(this.cacheDir,"isr",s)}async get(t){let s=this.getFilePath(t);if(!await Bun.file(s).exists())return null;try{return JSON.parse(await Bun.file(s).text())}catch{return null}}async set(t,s){let o=this.getFilePath(t);await x.promises.mkdir(g.dirname(o),{recursive:!0}),await Bun.write(o,JSON.stringify(s))}async invalidate(t){let s=this.getFilePath(t);if(await Bun.file(s).exists())await x.promises.unlink(s)}async invalidatePattern(t){let s=g.join(this.cacheDir,"isr");if(!x.existsSync(s))return;let o=await x.promises.readdir(s);for(let n of o){let c=n.replace(/_/g,"/").replace(".json","");if(t.test(c))await x.promises.unlink(g.join(s,n))}}async needsRevalidation(t){let s=await this.get(t);if(!s)return!0;return Date.now()>s.revalidateAfter}}async function Bt(t){try{let o=(await Bun.file(t).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let n=o[1];if(!n.includes("getStaticPaths"))return null;let c=n.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!c)return null;return await Function(`
2
+ import"./chunk-89b2r1q0.js";import"./chunk-3ry9ca1s.js";import{Qe,et,tt,nt,rt,st}from"./chunk-12pvnn1e.js";import"./chunk-yaebdyfr.js";import"./chunk-axydabse.js";import{f,je,M,q,n,i}from"./chunk-qm1tt8g1.js";import"./chunk-48kgnqpk.js";import{Yn}from"./chunk-jbrdebzs.js";import"./chunk-ptjqacjd.js";import"./chunk-h3c7z73m.js";import"./chunk-b7973zvk.js";import"./chunk-k8sqs7j2.js";import"./chunk-6cbvx87h.js";import{oe,ft,gt}from"./chunk-tfz95n7j.js";import{Ci,$i,Ei}from"./chunk-c1dmr865.js";import{dt,Xt,Gt}from"./chunk-yd50awqp.js";import"./chunk-2x9jd5w0.js";import{a}from"./chunk-wtms9jhs.js";import x from"fs";import g from"path";import{createHash as $t}from"crypto";function Dt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Rt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function kt(t){return Bun.hash(t).toString(16)}function lt(t,s={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let o=new Map,r=t.replace(Rt,(e,l,w,y)=>{let h=y.trim();if(!h)return e;if(/\bdata-stx-src=/.test(w))return e;if(s.minify)h=Dt(h);let S=kt(h);if(!o.has(S))o.set(S,h);let P=s.integrity?` data-stx-integrity="sha384-${$t("sha384").update(h).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${l}" data-stx-src="/_stx/islands/${S}.js"${P}${w}></script>`}),c=Array.from(o,([e,l])=>({hash:e,code:l}));return{html:r,chunks:c}}var Ct=new Set(["visible","idle"]);function ut(t){if(!t.includes("data-stx-src="))return t;let s=new Map,o=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,r;while((r=o.exec(t))!==null)s.set(r[1],r[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,l;while((l=e.exec(t))!==null)if(Ct.has(s.get(l[1])||""))c.add(l[2]);let w=t.lastIndexOf("</head>");if(c.size===0||w===-1)return t;let y=Array.from(c).filter((h)=>!t.includes(`rel="prefetch" href="${h}"`)).map((h)=>`<link rel="prefetch" href="${h}" as="script">`).join("");if(!y)return t;return t.slice(0,w)+y+t.slice(w)}var Et=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function J(t){let s=t.trim();if(!s)return null;let o=/^https?:\/\//i.test(s)?s:`https://${s}`;try{return new URL(o).origin+new URL(o).pathname.replace(/\/$/,"")}catch{return null}}function It(t){for(let s of Et){let o=t[s];if(!o)continue;let r=J(o);if(r)return{url:r,source:"env",via:s}}return null}function pt(t){if(!t||typeof t!=="object")return null;let s=t,o=s.site?.url??s.url??s.app?.url;return typeof o==="string"?J(o):null}async function Bt(t){let{existsSync:s}=await import("fs"),o=await import("path");for(let r of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=o.resolve(t,r);if(!s(c))continue;try{let e=await import(c),l=pt(e.default??e);if(l)return l}catch{}}return null}async function ht(t={}){let s=t.cwd??process.cwd(),o=t.env??process.env;if(t.explicit){let l=J(t.explicit);if(l)return{url:l,source:"option"}}let r=pt(t.stxConfig);if(r)return{url:r,source:"stx.config",via:"site.url"};let c=await Bt(s);if(c)return{url:c,source:"site.config",via:"url"};let e=It(o);if(e)return e;return{url:"http://localhost",source:"fallback"}}function mt(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
3
+ `)}class wt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,s=""){this.cacheDir=t,this.salt=s}async load(){if(this.loaded)return;let t=g.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let s=JSON.parse(await Bun.file(t).text());for(let[o,r]of Object.entries(s))this.cache.set(o,r)}catch{}this.loaded=!0}async save(){await x.promises.mkdir(this.cacheDir,{recursive:!0});let t=g.join(this.cacheDir,"build-cache.json"),s={};for(let[o,r]of this.cache)s[o]=r;await Bun.write(t,JSON.stringify(s))}getHash(t,s){let o=x.statSync(t),r=`${this.salt}|${t}:${o.mtimeMs}`;for(let e of s)if(x.existsSync(e)){let l=x.statSync(e);r+=`:${e}:${l.mtimeMs}`}let c=0;for(let e=0;e<r.length;e++){let l=r.charCodeAt(e);c=(c<<5)-c+l,c=c&c}return Math.abs(c).toString(36)}get(t,s){let o=this.cache.get(t);if(!o)return null;let r=this.getHash(s,o.dependencies??[]);if(o.hash!==r)return this.cache.delete(t),null;return o.html}set(t,s,o,r){let c=this.getHash(s,o);this.cache.set(t,{hash:c,html:r,generatedAt:Date.now(),dependencies:o})}}class yt{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let s=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return g.join(this.cacheDir,"isr",s)}async get(t){let s=this.getFilePath(t);if(!await Bun.file(s).exists())return null;try{return JSON.parse(await Bun.file(s).text())}catch{return null}}async set(t,s){let o=this.getFilePath(t);await x.promises.mkdir(g.dirname(o),{recursive:!0}),await Bun.write(o,JSON.stringify(s))}async invalidate(t){let s=this.getFilePath(t);if(await Bun.file(s).exists())await x.promises.unlink(s)}async invalidatePattern(t){let s=g.join(this.cacheDir,"isr");if(!x.existsSync(s))return;let o=await x.promises.readdir(s);for(let r of o){let c=r.replace(/_/g,"/").replace(".json","");if(t.test(c))await x.promises.unlink(g.join(s,r))}}async needsRevalidation(t){let s=await this.get(t);if(!s)return!0;return Date.now()>s.revalidateAfter}}async function jt(t){try{let o=(await Bun.file(t).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let r=o[1];if(!r.includes("getStaticPaths"))return null;let c=r.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!c)return null;return await Function(`
4
4
  return (async function getStaticPaths() {
5
5
  ${c[1]}
6
6
  })()
7
- `)()}catch(s){return console.error(`Error extracting static paths from ${t}:`,s),null}}async function jt(t){let s=[];if(!t.isDynamic)s.push({url:t.pattern,params:{}});else{let o=await Bt(t.filePath);if(!o||o.paths.length===0)return console.warn(`Warning: Dynamic route ${t.pattern} has no getStaticPaths or returned empty paths`),s;for(let n of o.paths){let c=t.pattern;for(let[e,l]of Object.entries(n.params))c=c.replace(`:${e}`,l).replace(`:${e}*`,l);s.push({url:c,params:n.params,props:n.props,revalidate:n.revalidate})}}return s}async function Ft(t){let s=[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"];for(let o of s)if(await Bun.file(o).exists())try{let n=await import(o);if(typeof n.default==="function")return await n.default();else if(typeof n.default==="object")return n.default;else if(typeof n.getData==="function")return await n.getData();else{let{default:c,...e}=n;return e}}catch(n){console.error(`Error loading data file ${o}:`,n)}return null}async function Ot(t,s,o){let n=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!n)return null;let c=n[1];if(!c.includes("getStaticProps"))return null;try{let e=c.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
7
+ `)()}catch(s){return console.error(`Error extracting static paths from ${t}:`,s),null}}async function Ft(t){let s=[];if(!t.isDynamic)s.push({url:t.pattern,params:{}});else{let o=await jt(t.filePath);if(!o||o.paths.length===0)return console.warn(`Warning: Dynamic route ${t.pattern} has no getStaticPaths or returned empty paths`),s;for(let r of o.paths){let c=t.pattern;for(let[e,l]of Object.entries(r.params))c=c.replace(`:${e}`,l).replace(`:${e}*`,l);s.push({url:c,params:r.params,props:r.props,revalidate:r.revalidate})}}return s}async function Ot(t){let s=[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"];for(let o of s)if(await Bun.file(o).exists())try{let r=await import(o);if(typeof r.default==="function")return await r.default();else if(typeof r.default==="object")return r.default;else if(typeof r.getData==="function")return await r.getData();else{let{default:c,...e}=r;return e}}catch(r){console.error(`Error loading data file ${o}:`,r)}return null}async function Tt(t,s,o){let r=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!r)return null;let c=r[1];if(!c.includes("getStaticProps"))return null;try{let e=c.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
8
8
  return (async function getStaticProps() {
9
9
  ${e[1]}
10
10
  })()
11
- `)(s)}catch(e){return console.error(`Error executing getStaticProps in ${o}:`,e),null}}function Tt(t){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(t)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(t)}async function yt(t,s,o={},n,c){let e=await Bun.file(t.filePath).text(),l=await Ft(t.filePath),w=await Ot(e,s,t.filePath),y={...l||{},...w||{},...o,params:s,$route:{path:t.pattern,params:s}},h=new Set,S=[],P=[],D={...c,...n.partialsDir?{partialsDir:n.partialsDir}:{},...n.componentsDir?{componentsDir:n.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(b)=>{S.push(`${g.relative(process.cwd(),b.templatePath)}: ${b.message}
12
- resolved against partialsDir: ${b.partialsDir}`)},onServerScriptError:(b)=>{P.push(`${g.relative(process.cwd(),b.sourcePath)} (${b.kind}): ${b.message}`)}};if(Tt(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let p=await r(e,y,t.filePath,D,h);for(let b of[t.filePath,...h])for(let B of oe(b))h.add(B);if(Object.keys(s).length>0){let b=`<script>if(window.stx)window.stx._rp=${JSON.stringify(s)};else window.__stx_rp=${JSON.stringify(s)};</script>`;if(p.includes("</head>"))p=p.replace("</head>",`${b}
11
+ `)(s)}catch(e){return console.error(`Error executing getStaticProps in ${o}:`,e),null}}function At(t){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(t)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(t)}async function St(t,s,o={},r,c){let e=await Bun.file(t.filePath).text(),l=await Ot(t.filePath),w=await Tt(e,s,t.filePath),y={...l||{},...w||{},...o,params:s,$route:{path:t.pattern,params:s}},h=new Set,S=[],P=[],D={...c,...r.partialsDir?{partialsDir:r.partialsDir}:{},...r.componentsDir?{componentsDir:r.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(b)=>{S.push(`${g.relative(process.cwd(),b.templatePath)}: ${b.message}
12
+ resolved against partialsDir: ${b.partialsDir}`)},onServerScriptError:(b)=>{P.push(`${g.relative(process.cwd(),b.sourcePath)} (${b.kind}): ${b.message}`)}};if(At(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let p=await n(e,y,t.filePath,D,h);for(let b of[t.filePath,...h])for(let B of oe(b))h.add(B);if(Object.keys(s).length>0){let b=`<script>if(window.stx)window.stx._rp=${JSON.stringify(s)};else window.__stx_rp=${JSON.stringify(s)};</script>`;if(p.includes("</head>"))p=p.replace("</head>",`${b}
13
13
  </head>`);else p=`${b}
14
- ${p}`}if(p=await q(p,{router:n.router}),p=await f(p),n.minify!==!1)return{html:At(p),dependencies:Array.from(h),includeFailures:S,serverScriptFailures:P};return{html:p,dependencies:Array.from(h),includeFailures:S,serverScriptFailures:P}}function At(t){let s=[],o=0,n=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,c;while((c=n.exec(t))!==null){let l=t.slice(o,c.index);s.push(l.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let w=c[1],y=c[2],h=c[3];y=y.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),s.push(w+y+h),o=c.index+c[0].length}let e=t.slice(o);return s.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),s.join("").trim()}function Lt(t){let s=0;for(let o=0;o<t.length;o++){let n=t.charCodeAt(o);s=(s<<5)-s+n,s=s&s}return`"${Math.abs(s).toString(36)}"`}function Mt(t,s,o,n){if(o?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(s))return!0;return n.some((c)=>{if(c instanceof RegExp)return c.test(t);return c.endsWith("/")?t===c.slice(0,-1)||t.startsWith(c):t===c})}function Ut(t,s){return`<?xml version="1.0" encoding="UTF-8"?>
14
+ ${p}`}if(p=await q(p,{router:r.router}),p=await f(p),r.minify!==!1)return{html:Lt(p),dependencies:Array.from(h),includeFailures:S,serverScriptFailures:P};return{html:p,dependencies:Array.from(h),includeFailures:S,serverScriptFailures:P}}function Lt(t){let s=[],o=0,r=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,c;while((c=r.exec(t))!==null){let l=t.slice(o,c.index);s.push(l.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let w=c[1],y=c[2],h=c[3];y=y.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),s.push(w+y+h),o=c.index+c[0].length}let e=t.slice(o);return s.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),s.join("").trim()}function Mt(t){let s=0;for(let o=0;o<t.length;o++){let r=t.charCodeAt(o);s=(s<<5)-s+r,s=s&s}return`"${Math.abs(s).toString(36)}"`}function Ut(t,s,o,r){if(o?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(s))return!0;return r.some((c)=>{if(c instanceof RegExp)return c.test(t);return c.endsWith("/")?t===c.slice(0,-1)||t.startsWith(c):t===c})}function _t(t,s){return`<?xml version="1.0" encoding="UTF-8"?>
15
15
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
16
- ${t.map((n)=>{let c=new URL(n.loc,s).href,e=` <url>
17
- <loc>${I(c)}</loc>`;if(n.lastmod)e+=`
18
- <lastmod>${n.lastmod}</lastmod>`;if(n.changefreq)e+=`
19
- <changefreq>${n.changefreq}</changefreq>`;if(n.priority!==void 0)e+=`
20
- <priority>${n.priority}</priority>`;return e+=`
16
+ ${t.map((r)=>{let c=new URL(r.loc,s).href,e=` <url>
17
+ <loc>${I(c)}</loc>`;if(r.lastmod)e+=`
18
+ <lastmod>${r.lastmod}</lastmod>`;if(r.changefreq)e+=`
19
+ <changefreq>${r.changefreq}</changefreq>`;if(r.priority!==void 0)e+=`
20
+ <priority>${r.priority}</priority>`;return e+=`
21
21
  </url>`,e}).join(`
22
22
  `)}
23
- </urlset>`}function I(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function _t(t,s){let o=s.map((n)=>{let c=" <item>";if(c+=`
24
- <title>${I(n.title)}</title>`,c+=`
25
- <link>${I(n.link)}</link>`,n.description)c+=`
26
- <description>${I(n.description)}</description>`;if(n.pubDate)c+=`
27
- <pubDate>${n.pubDate.toUTCString()}</pubDate>`;if(n.author)c+=`
28
- <author>${I(n.author)}</author>`;if(n.categories)for(let e of n.categories)c+=`
29
- <category>${I(e)}</category>`;if(n.guid)c+=`
30
- <guid>${I(n.guid)}</guid>`;return c+=`
23
+ </urlset>`}function I(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Nt(t,s){let o=s.map((r)=>{let c=" <item>";if(c+=`
24
+ <title>${I(r.title)}</title>`,c+=`
25
+ <link>${I(r.link)}</link>`,r.description)c+=`
26
+ <description>${I(r.description)}</description>`;if(r.pubDate)c+=`
27
+ <pubDate>${r.pubDate.toUTCString()}</pubDate>`;if(r.author)c+=`
28
+ <author>${I(r.author)}</author>`;if(r.categories)for(let e of r.categories)c+=`
29
+ <category>${I(e)}</category>`;if(r.guid)c+=`
30
+ <guid>${I(r.guid)}</guid>`;return c+=`
31
31
  </item>`,c});return`<?xml version="1.0" encoding="UTF-8"?>
32
32
  <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
33
33
  <channel>
@@ -41,18 +41,18 @@ ${t.map((n)=>{let c=new URL(n.loc,s).href,e=` <url>
41
41
  ${o.join(`
42
42
  `)}
43
43
  </channel>
44
- </rss>`}async function Gt(t={}){let s=Date.now();ft();let o=await i(process.cwd()),n=o.build||{},c=await gt({explicit:t.domain||n.domain,stxConfig:o});if(c.source==="fallback"&&(t.sitemap??n.sitemap??!0))console.warn(ht());let e={router:t.router??o?.router??{},pagesDir:t.pagesDir||n.pagesDir||"pages",outputDir:t.outputDir||n.outputDir||"dist",baseUrl:t.baseUrl||n.baseUrl||"/",domain:c.url,revalidate:t.revalidate??n.revalidate??!1,sitemap:t.sitemap??n.sitemap??!0,sitemapExclude:t.sitemapExclude||n.sitemapExclude||[],robots:t.robots??n.robots??!0,rss:t.rss??n.rss??!1,concurrency:t.concurrency||n.concurrency||10,cache:t.cache??n.cache??!0,cacheDir:t.cacheDir||n.cacheDir||a(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??n.minify??!0,generate404:t.generate404??n.generate404??!0,publicDir:t.publicDir||n.publicDir||"public",trailingSlash:t.trailingSlash??n.trailingSlash??!1,cleanOutput:t.cleanOutput??n.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||o?.partialsDir||"",componentsDir:t.componentsDir||o?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},l={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},w=new Set,y=0,h={},S={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&x.existsSync(e.outputDir))await x.promises.rm(e.outputDir,{recursive:!0});await x.promises.mkdir(e.outputDir,{recursive:!0});let D=e.cacheSalt;if(!D){let{resolveUserCssConfig:u,fingerprintConfig:m}=await import("./chunk-4488r5j1.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-mk7b3qdz.js"),b=await p(e.publicDir,e.outputDir);if(b.count>0)console.log(`Optimized ${b.count} image(s) for responsive delivery`),D=[D,b.fingerprint].filter(Boolean).join(":");let B=new mt(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-4488r5j1.js");await u('<div class="bg-black"></div>')}catch{}Ze();let St=o?.routeMiddleware?.dir||"middleware";await et(process.cwd(),St);let H=Qe();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let xt=o?.routeMiddleware?.global||[];ki(o?.layoutsDir,a(process.cwd()));let K=M(".",{pagesDir:e.pagesDir,pagesDirs:o?._layerPageDirs});console.log(`Found ${K.length} routes`);let G=[];for(let u of K){let m=await jt(u);for(let v of m)G.push({route:u,url:v.url,params:v.params,props:v.props,revalidate:v.revalidate??e.revalidate})}l.totalPages=G.length,console.log(`Generating ${l.totalPages} pages...`);let A=[],X=[];for(let u=0;u<G.length;u+=e.concurrency)X.push(G.slice(u,u+e.concurrency));for(let u of X)await Promise.all(u.map(async(m)=>{let{route:v,url:d,params:L,props:vt,revalidate:Q}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Wt(j),bt=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],it=[...xt,...bt];if(it.length>0){let C=tt(d,L,F||{}),O=nt(C,null,void 0,{isServer:!0}),E=await rt(it,O);if(E.redirect){let R=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,_=qt(String(R),d),T=Jt(d,e);await x.promises.mkdir(g.dirname(T),{recursive:!0}),await Bun.write(T,_),l.successCount++,l.pages.push({route:d,outputPath:T,size:Buffer.byteLength(_),cached:!1}),A.push({loc:d,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${d} \u2192 redirect to ${R}`);return}if(E.abort){let R=typeof E.abort==="string"?E.abort:E.abort?.error?.message||"aborted";console.warn(` \u21B3 ${d} \u2014 middleware aborted: ${R}`);return}}let st=j.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(st)try{if(!await Function("route",`
45
- const validate = ${st[1]};
44
+ </rss>`}async function zt(t={}){let s=Date.now();gt();let o=await i(process.cwd()),r=o.build||{},c=await ht({explicit:t.domain||r.domain,stxConfig:o});if(c.source==="fallback"&&(t.sitemap??r.sitemap??!0))console.warn(mt());let e={router:t.router??o?.router??{},pagesDir:t.pagesDir||r.pagesDir||"pages",outputDir:t.outputDir||r.outputDir||"dist",baseUrl:t.baseUrl||r.baseUrl||"/",domain:c.url,revalidate:t.revalidate??r.revalidate??!1,sitemap:t.sitemap??r.sitemap??!0,sitemapExclude:t.sitemapExclude||r.sitemapExclude||[],robots:t.robots??r.robots??!0,rss:t.rss??r.rss??!1,concurrency:t.concurrency||r.concurrency||10,cache:t.cache??r.cache??!0,cacheDir:t.cacheDir||r.cacheDir||a(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??r.minify??!0,generate404:t.generate404??r.generate404??!0,publicDir:t.publicDir||r.publicDir||"public",trailingSlash:t.trailingSlash??r.trailingSlash??!1,cleanOutput:t.cleanOutput??r.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||o?.partialsDir||"",componentsDir:t.componentsDir||o?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},l={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},w=new Set,y=0,h={},S={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&x.existsSync(e.outputDir))await x.promises.rm(e.outputDir,{recursive:!0});await x.promises.mkdir(e.outputDir,{recursive:!0});let D=e.cacheSalt;if(!D){let{resolveUserCssConfig:u,fingerprintConfig:m}=await import("./chunk-zm73n103.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-h7qte7ye.js"),b=await p(e.publicDir,e.outputDir);if(b.count>0)console.log(`Optimized ${b.count} image(s) for responsive delivery`),D=[D,b.fingerprint].filter(Boolean).join(":");let B=new wt(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-zm73n103.js");await u('<div class="bg-black"></div>')}catch{}Qe();let xt=o?.routeMiddleware?.dir||"middleware";await tt(process.cwd(),xt);let H=et();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let vt=o?.routeMiddleware?.global||[];Ei(o?.layoutsDir,a(process.cwd()));let K=M(".",{pagesDir:e.pagesDir,pagesDirs:o?._layerPageDirs});console.log(`Found ${K.length} routes`);let G=[];for(let u of K){let m=await Ft(u);for(let v of m)G.push({route:u,url:v.url,params:v.params,props:v.props,revalidate:v.revalidate??e.revalidate})}l.totalPages=G.length,console.log(`Generating ${l.totalPages} pages...`);let A=[],X=[];for(let u=0;u<G.length;u+=e.concurrency)X.push(G.slice(u,u+e.concurrency));for(let u of X)await Promise.all(u.map(async(m)=>{let{route:v,url:d,params:L,props:bt,revalidate:Q}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Jt(j),Pt=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],it=[...vt,...Pt];if(it.length>0){let C=nt(d,L,F||{}),O=rt(C,null,void 0,{isServer:!0}),E=await st(it,O);if(E.redirect){let R=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,_=Vt(String(R),d),T=Kt(d,e);await x.promises.mkdir(g.dirname(T),{recursive:!0}),await Bun.write(T,_),l.successCount++,l.pages.push({route:d,outputPath:T,size:Buffer.byteLength(_),cached:!1}),A.push({loc:d,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${d} \u2192 redirect to ${R}`);return}if(E.abort){let R=typeof E.abort==="string"?E.abort:E.abort?.error?.message||"aborted";console.warn(` \u21B3 ${d} \u2014 middleware aborted: ${R}`);return}}let at=j.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(at)try{if(!await Function("route",`
45
+ const validate = ${at[1]};
46
46
  return validate(route);
47
- `)({params:L})){console.warn(`Validation failed for ${d}, skipping...`);return}}catch{}let k=null,at=!1;if(e.cache){if(k=B.get(d,v.filePath),k)at=!0,l.cachedCount++}if(!k){let C=await yt(v,L,vt,e,o);if(k=C.html,e.failOnIncludeError&&C.includeFailures.length>0)throw Error(`${C.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
47
+ `)({params:L})){console.warn(`Validation failed for ${d}, skipping...`);return}}catch{}let k=null,ot=!1;if(e.cache){if(k=B.get(d,v.filePath),k)ot=!0,l.cachedCount++}if(!k){let C=await St(v,L,bt,e,o);if(k=C.html,e.failOnIncludeError&&C.includeFailures.length>0)throw Error(`${C.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
48
48
  ${C.includeFailures.join(`
49
49
  `)}
50
50
  Set ssg.failOnIncludeError to false to build anyway.`);if(e.failOnServerScriptError&&C.serverScriptFailures.length>0)throw Error(`${C.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
51
51
  ${C.serverScriptFailures.join(`
52
52
  `)}
53
- Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)B.set(d,v.filePath,C.dependencies,k)}let U;if(e.trailingSlash)U=g.join(e.outputDir,d,"index.html");else U=d==="/"?g.join(e.outputDir,"index.html"):g.join(e.outputDir,`${d}.html`);if(e.chunkIslands){let{html:C,chunks:O}=ct(k,{integrity:e.integrityIslands,minify:e.minify});if(O.length>0){let E=g.join(e.outputDir,"_stx","islands");await x.promises.mkdir(E,{recursive:!0});for(let R of O){let _=g.join(E,`${R.hash}.js`);if(!await Bun.file(_).exists())await Bun.write(_,R.code);if(!w.has(R.hash)){w.add(R.hash);let T=Buffer.byteLength(R.code,"utf8");y+=T,h[R.hash]={bytes:T,file:`/_stx/islands/${R.hash}.js`}}}if(S[d]=O.map((R)=>R.hash),k=C,e.prefetchIslands)k=lt(k)}}if(await x.promises.mkdir(g.dirname(U),{recursive:!0}),await Bun.write(U,k),!Mt(d,k,F,e.sitemapExclude))A.push({loc:d,lastmod:new Date().toISOString().split("T")[0],priority:d==="/"?1:0.8});let ot={route:d,outputPath:U,size:Buffer.byteLength(k,"utf8"),cached:at};if(Q!==!1)ot.revalidateAt=Date.now()+Q*1000;l.pages.push(ot),l.successCount++,await e.hooks.onPageEnd?.(d,k)}catch(j){l.failedCount++,l.errors.push({route:d,error:j}),await e.hooks.onError?.(j,d),console.error(`Error generating ${d}:`,j)}}));let Y=pt();if(Y.length>0){let u=Y.map((m)=>`${m.filePath}: ${m.message}`).join(`
53
+ Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)B.set(d,v.filePath,C.dependencies,k)}let U;if(e.trailingSlash)U=g.join(e.outputDir,d,"index.html");else U=d==="/"?g.join(e.outputDir,"index.html"):g.join(e.outputDir,`${d}.html`);if(e.chunkIslands){let{html:C,chunks:O}=lt(k,{integrity:e.integrityIslands,minify:e.minify});if(O.length>0){let E=g.join(e.outputDir,"_stx","islands");await x.promises.mkdir(E,{recursive:!0});for(let R of O){let _=g.join(E,`${R.hash}.js`);if(!await Bun.file(_).exists())await Bun.write(_,R.code);if(!w.has(R.hash)){w.add(R.hash);let T=Buffer.byteLength(R.code,"utf8");y+=T,h[R.hash]={bytes:T,file:`/_stx/islands/${R.hash}.js`}}}if(S[d]=O.map((R)=>R.hash),k=C,e.prefetchIslands)k=ut(k)}}if(await x.promises.mkdir(g.dirname(U),{recursive:!0}),await Bun.write(U,k),!Ut(d,k,F,e.sitemapExclude))A.push({loc:d,lastmod:new Date().toISOString().split("T")[0],priority:d==="/"?1:0.8});let ct={route:d,outputPath:U,size:Buffer.byteLength(k,"utf8"),cached:ot};if(Q!==!1)ct.revalidateAt=Date.now()+Q*1000;l.pages.push(ct),l.successCount++,await e.hooks.onPageEnd?.(d,k)}catch(j){l.failedCount++,l.errors.push({route:d,error:j}),await e.hooks.onError?.(j,d),console.error(`Error generating ${d}:`,j)}}));let Y=ft();if(Y.length>0){let u=Y.map((m)=>`${m.filePath}: ${m.message}`).join(`
54
54
  `);throw Error(`Client script bundling failed:
55
- ${u}`)}if(e.cache)await B.save();if(e.generate404){let u=g.join(e.pagesDir,"404.stx");if(await Bun.file(u).exists()){let m=new Set,v={...o,debug:!1,cache:!1},d=await r(await Bun.file(u).text(),{},u,v,m);await Bun.write(g.join(e.outputDir,"404.html"),d)}else await Bun.write(g.join(e.outputDir,"404.html"),`<!DOCTYPE html>
55
+ ${u}`)}if(e.cache)await B.save();if(e.generate404){let u=g.join(e.pagesDir,"404.stx");if(await Bun.file(u).exists()){let m=new Set,v={...o,debug:!1,cache:!1},d=await n(await Bun.file(u).text(),{},u,v,m);await Bun.write(g.join(e.outputDir,"404.html"),d)}else await Bun.write(g.join(e.outputDir,"404.html"),`<!DOCTYPE html>
56
56
  <html lang="en">
57
57
  <head>
58
58
  <meta charset="UTF-8">
@@ -73,7 +73,7 @@ ${u}`)}if(e.cache)await B.save();if(e.generate404){let u=g.join(e.pagesDir,"404.
73
73
  <a href="/">Go home</a>
74
74
  </div>
75
75
  </body>
76
- </html>`)}for(let u of[500]){let m=g.join(e.pagesDir,`${u}.stx`);if(await Bun.file(m).exists()){let v=new Set,d={...o,debug:!1,cache:!1},L=await r(await Bun.file(m).text(),{},m,d,v);await Bun.write(g.join(e.outputDir,`${u}.html`),L)}}let W=g.join(e.pagesDir,"error.stx");if(await Bun.file(W).exists()){let u=new Set,m={...o,debug:!1,cache:!1},v=await r(await Bun.file(W).text(),{},W,m,u);await Bun.write(g.join(e.outputDir,"error.html"),v)}if(e.sitemap&&A.length>0){let u=Ut(A,e.domain),m=g.join(e.outputDir,"sitemap.xml");await Bun.write(m,u),l.sitemapPath=m,console.log(`Generated sitemap.xml with ${A.length} URLs`)}if(e.robots!==!1){let u=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((d)=>typeof d==="string"),...u.disallow||[]],v=Jn({rules:[{userAgent:u.userAgent||"*",allow:u.allow||["/"],...m.length>0?{disallow:m}:{}}],...u.sitemap!==!1&&l.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(g.join(e.outputDir,"robots.txt"),v),console.log("Generated robots.txt")}if(e.rss){let u=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(u.getItems)m=await u.getItems();let v=_t(u,m),d=g.join(e.outputDir,"rss.xml");await Bun.write(d,v),l.rssPath=d,console.log(`Generated rss.xml with ${m.length} items`)}let N=xi(e.outputDir);if(N.assets>0)console.log(`Externalized ${N.assets} asset(s) from ${N.pages} page(s) (${(N.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let z=Si(e.outputDir);if(z.assets>0)console.log(`Externalized ${z.assets} repeated asset(s) from ${z.pages} page(s) (${(z.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&x.existsSync(e.publicDir))await V(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let Z=Xt();if(Z)await V(Z,g.join(e.outputDir,Kt)),console.log(`Copied assets from ${ut}`)}catch(D){throw await e.hooks.onError?.(D),D}if(l.buildTime=Date.now()-s,w.size>0){l.islandChunks={count:w.size,totalBytes:y};let D={generatedChunks:w.size,totalBytes:y,chunks:h,pages:S};await Bun.write(g.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(D,null,2))}await e.hooks.onBuildEnd?.(l);let P=l.islandChunks?`
76
+ </html>`)}for(let u of[500]){let m=g.join(e.pagesDir,`${u}.stx`);if(await Bun.file(m).exists()){let v=new Set,d={...o,debug:!1,cache:!1},L=await n(await Bun.file(m).text(),{},m,d,v);await Bun.write(g.join(e.outputDir,`${u}.html`),L)}}let W=g.join(e.pagesDir,"error.stx");if(await Bun.file(W).exists()){let u=new Set,m={...o,debug:!1,cache:!1},v=await n(await Bun.file(W).text(),{},W,m,u);await Bun.write(g.join(e.outputDir,"error.html"),v)}if(e.sitemap&&A.length>0){let u=_t(A,e.domain),m=g.join(e.outputDir,"sitemap.xml");await Bun.write(m,u),l.sitemapPath=m,console.log(`Generated sitemap.xml with ${A.length} URLs`)}if(e.robots!==!1){let u=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((d)=>typeof d==="string"),...u.disallow||[]],v=Yn({rules:[{userAgent:u.userAgent||"*",allow:u.allow||["/"],...m.length>0?{disallow:m}:{}}],...u.sitemap!==!1&&l.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(g.join(e.outputDir,"robots.txt"),v),console.log("Generated robots.txt")}if(e.rss){let u=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(u.getItems)m=await u.getItems();let v=Nt(u,m),d=g.join(e.outputDir,"rss.xml");await Bun.write(d,v),l.rssPath=d,console.log(`Generated rss.xml with ${m.length} items`)}let N=Ci(e.outputDir);if(N.assets>0)console.log(`Externalized ${N.assets} asset(s) from ${N.pages} page(s) (${(N.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let z=$i(e.outputDir);if(z.assets>0)console.log(`Externalized ${z.assets} repeated asset(s) from ${z.pages} page(s) (${(z.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&x.existsSync(e.publicDir))await V(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let Z=Gt();if(Z)await V(Z,g.join(e.outputDir,Xt)),console.log(`Copied assets from ${dt}`)}catch(D){throw await e.hooks.onError?.(D),D}if(l.buildTime=Date.now()-s,w.size>0){l.islandChunks={count:w.size,totalBytes:y};let D={generatedChunks:w.size,totalBytes:y,chunks:h,pages:S};await Bun.write(g.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(D,null,2))}await e.hooks.onBuildEnd?.(l);let P=l.islandChunks?`
77
77
  Island chunks: ${l.islandChunks.count} (${(l.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
78
78
  Build complete!
79
79
  Total: ${l.totalPages} pages
@@ -81,8 +81,8 @@ Build complete!
81
81
  Cached: ${l.cachedCount}
82
82
  Failed: ${l.failedCount}
83
83
  Time: ${l.buildTime}ms${P}
84
- `),l}async function V(t,s){await x.promises.mkdir(s,{recursive:!0});let o=await x.promises.readdir(t,{withFileTypes:!0});for(let n of o){let c=g.join(t,n.name),e=g.join(s,n.name);if(n.isDirectory())await x.promises.mkdir(e,{recursive:!0}),await V(c,e);else await x.promises.copyFile(c,e)}}function Nt(t={}){let s=t.cacheDir||a(process.cwd(),"ssg-cache"),o=new wt(s),n=t.revalidate||3600;return{async get(c){let e=await o.get(c);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(c).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${n}, stale-while-revalidate=${n*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(c){let l=M(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>c.match(P.regex)!==null);if(!l){console.warn(`Route not found for revalidation: ${c}`);return}let w=c.match(l.regex),y={};if(w)l.params.forEach((P,D)=>{y[P]=w[D+1]});let h=await i(),{html:S}=await yt(l,y,{},t,h);await o.set(c,{html:S,generatedAt:Date.now(),revalidateAfter:Date.now()+n*1000,etag:Lt(S)}),console.log(`Revalidated: ${c}`)},async invalidate(c){if(typeof c==="string")await o.invalidate(c);else await o.invalidatePattern(c)}}}function zt(t){return async()=>({paths:await t(),fallback:!1})}function Ht(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let s=await Bun.file(t).text(),o=s.match(/^---\n([\s\S]*?)\n---/),n={},c=s;if(o){let h=o[1];c=s.slice(o[0].length).trim();for(let S of h.split(`
85
- `)){let P=S.indexOf(":");if(P>0){let D=S.slice(0,P).trim(),p=S.slice(P+1).trim();if(p==="true")p=!0;else if(p==="false")p=!1;else if(/^\d+$/.test(p))p=parseInt(p,10);else if(/^\d+\.\d+$/.test(p))p=parseFloat(p);else if(p.startsWith("[")&&p.endsWith("]"))p=p.slice(1,-1).split(",").map((b)=>b.trim().replace(/^['"]|['"]$/g,""));n[D]=p}}}let e=c.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),l=[],w=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,y;while((y=w.exec(e))!==null){let h=parseInt(y[1],10),S=y[2],P=S.toLowerCase().replace(/[^a-z0-9]+/g,"-");l.push({id:P,text:S,level:h})}return{content:e,data:n,toc:l}}}}function Wt(t){return Le(t)}function qt(t,s){return`<!DOCTYPE html>
84
+ `),l}async function V(t,s){await x.promises.mkdir(s,{recursive:!0});let o=await x.promises.readdir(t,{withFileTypes:!0});for(let r of o){let c=g.join(t,r.name),e=g.join(s,r.name);if(r.isDirectory())await x.promises.mkdir(e,{recursive:!0}),await V(c,e);else await x.promises.copyFile(c,e)}}function Ht(t={}){let s=t.cacheDir||a(process.cwd(),"ssg-cache"),o=new yt(s),r=t.revalidate||3600;return{async get(c){let e=await o.get(c);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(c).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${r}, stale-while-revalidate=${r*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(c){let l=M(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>c.match(P.regex)!==null);if(!l){console.warn(`Route not found for revalidation: ${c}`);return}let w=c.match(l.regex),y={};if(w)l.params.forEach((P,D)=>{y[P]=w[D+1]});let h=await i(),{html:S}=await St(l,y,{},t,h);await o.set(c,{html:S,generatedAt:Date.now(),revalidateAfter:Date.now()+r*1000,etag:Mt(S)}),console.log(`Revalidated: ${c}`)},async invalidate(c){if(typeof c==="string")await o.invalidate(c);else await o.invalidatePattern(c)}}}function Wt(t){return async()=>({paths:await t(),fallback:!1})}function qt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let s=await Bun.file(t).text(),o=s.match(/^---\n([\s\S]*?)\n---/),r={},c=s;if(o){let h=o[1];c=s.slice(o[0].length).trim();for(let S of h.split(`
85
+ `)){let P=S.indexOf(":");if(P>0){let D=S.slice(0,P).trim(),p=S.slice(P+1).trim();if(p==="true")p=!0;else if(p==="false")p=!1;else if(/^\d+$/.test(p))p=parseInt(p,10);else if(/^\d+\.\d+$/.test(p))p=parseFloat(p);else if(p.startsWith("[")&&p.endsWith("]"))p=p.slice(1,-1).split(",").map((b)=>b.trim().replace(/^['"]|['"]$/g,""));r[D]=p}}}let e=c.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),l=[],w=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,y;while((y=w.exec(e))!==null){let h=parseInt(y[1],10),S=y[2],P=S.toLowerCase().replace(/[^a-z0-9]+/g,"-");l.push({id:P,text:S,level:h})}return{content:e,data:r,toc:l}}}}function Jt(t){return je(t)}function Vt(t,s){return`<!DOCTYPE html>
86
86
  <html>
87
87
  <head>
88
88
  <meta charset="utf-8">
@@ -94,4 +94,4 @@ Build complete!
94
94
  <p>Redirecting to <a href="${t}">${t}</a>...</p>
95
95
  <script>window.location.replace('${t}')</script>
96
96
  </body>
97
- </html>`}function Jt(t,s){if(t==="/"||t==="")return g.join(s.outputDir,"index.html");let o=t.replace(/^\/|\/$/g,"");if(s.trailingSlash)return g.join(s.outputDir,o,"index.html");return g.join(s.outputDir,`${o}.html`)}var ye={generateStaticSite:Gt,createISRHandler:Nt,defineStaticPaths:zt,createMarkdownLoader:Ht};export{Nt as createISRHandler,Ht as createMarkdownLoader,Tt as declaresPageAction,ye as default,zt as defineStaticPaths,Gt as generateStaticSite,Mt as isExcludedFromSitemap};
97
+ </html>`}function Kt(t,s){if(t==="/"||t==="")return g.join(s.outputDir,"index.html");let o=t.replace(/^\/|\/$/g,"");if(s.trailingSlash)return g.join(s.outputDir,o,"index.html");return g.join(s.outputDir,`${o}.html`)}var Se={generateStaticSite:zt,createISRHandler:Ht,defineStaticPaths:Wt,createMarkdownLoader:qt};export{Ht as createISRHandler,qt as createMarkdownLoader,At as declaresPageAction,Se as default,Wt as defineStaticPaths,zt as generateStaticSite,Ut as isExcludedFromSitemap};
@@ -223,7 +223,10 @@ export function stripTypeScript(scriptContent) {
223
223
  return result;
224
224
  }
225
225
  export function withoutStxReferrer(message) {
226
- return message.replace(/\s*imported from \S*(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])\S*/g, "");
226
+ return message.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g, (referrer, ...groups) => {
227
+ const [, quotedPath, barePath] = groups, importer = quotedPath ?? barePath;
228
+ return /(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(importer) ? "" : referrer;
229
+ });
227
230
  }
228
231
  export function isModuleResolutionFailure(message) {
229
232
  return /cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(message);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.421",
4
+ "version": "0.2.423",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -122,12 +122,12 @@
122
122
  "dependencies": {
123
123
  "@stacksjs/ts-css": "^0.3.2",
124
124
  "@stacksjs/clapp": "^0.2.16",
125
- "@stacksjs/desktop": "0.2.421",
126
- "@stacksjs/sanitizer": "0.2.421",
125
+ "@stacksjs/desktop": "0.2.423",
126
+ "@stacksjs/sanitizer": "0.2.423",
127
127
  "@stacksjs/ts-i18n": "^0.1.11",
128
- "bun-plugin-stx": "0.2.421",
128
+ "bun-plugin-stx": "0.2.423",
129
129
  "bunfig": "^0.15.19",
130
- "stx-router": "0.2.421",
130
+ "stx-router": "0.2.423",
131
131
  "ts-broadcasting": "^0.0.11",
132
132
  "ts-images": "^0.2.22",
133
133
  "ts-syntax-highlighter": "^0.2.1"
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Gs,Uo}from"./chunk-m16h8ea0.js";import"./chunk-r8wze9ym.js";export{Uo as createImageHandler,Gs as handleImageRequest};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{zo,Hc}from"./chunk-aync8qmk.js";export{zo as captureScreenshot,Hc as captureScreenshots};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{kr,Cr,$r,Qo,Er,Tr,ea,_r,Rr,oi,ta}from"./chunk-rsxvbnp4.js";export{kr as VideoProcessorCache,oi as analyzeVideo,Qo as clearVideoCache,Rr as generateDASHManifest,_r as generateHLSManifest,Er as generatePoster,ea as generateSpriteSheet,Tr as generateThumbnails,Cr as getCachedVideoResult,ta as processVideo,$r as setCachedVideoResult};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Ci,$i,Ei,Ca,$a}from"./chunk-wg1ttvs5.js";export{$i as auditBuildOutput,Ci as auditConfig,Ei as calculateAuditResult,$a as formatAuditResult,Ca as runPwaAudit};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{q,as,cs,ls,r}from"./chunk-rj3hyqff.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-4e101kjp.js";import"./chunk-62r4fa4q.js";import"./chunk-32y3767j.js";import"./chunk-ax58cds3.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{q as injectRouterScript,r as processDirectives,as as processJsonDirective,cs as processOnceDirective,ls as validateClientScript};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Eu,Li,Tu,ji,qa,Ka,wt,Qt,_u,Xa,Ga,Ja,f}from"./chunk-rj3hyqff.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-4e101kjp.js";import"./chunk-62r4fa4q.js";import"./chunk-32y3767j.js";import"./chunk-ax58cds3.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{wt as buildCss,Xa as extractClassNames,Ka as fingerprintConfig,Ga as generateCss,_u as getCachedCSS,Eu as getCssServeAsset,f as injectCss,Li as loadCssEngine,ji as loadCssEngineConfig,Qt as rebuildCss,Tu as resetCssCache,qa as resolveUserCssConfig,Ja as withLinkedModuleBundles};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{$n,Ut,Hl}from"./chunk-8j8k27xb.js";import{z,En,Vt,Pr,Ir,Tn,Ul,Vl,Wl,Wt,qt,Dr,_n,ql}from"./chunk-8drvzsk1.js";import"./chunk-757ec865.js";export{Pr as batch,Hl as default,En as derived,Vt as effect,$n as generateSignalsRuntime,Ut as generateSignalsRuntimeDev,qt as isDerived,Wt as isSignal,Tn as onDestroy,Ir as onMount,_n as peek,Wl as pendingLifecycleCounts,Vl as runDestroyCallbacks,Ul as runMountCallbacks,z as state,Dr as untrack,ql as useOptimistic};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Vc}from"./chunk-89e1d0rz.js";import"./chunk-cw6j75ck.js";import"./chunk-8j8k27xb.js";import"./chunk-z0ck9t6j.js";import"./chunk-rj3hyqff.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-4e101kjp.js";import"./chunk-62r4fa4q.js";import"./chunk-32y3767j.js";import"./chunk-ax58cds3.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{Vc as buildForProduction};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Pu,Za,Yr,Zr,Fi,zi,Qr,es,Qa,ec,Hi,Ui,tc,Fe}from"./chunk-rj3hyqff.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-4e101kjp.js";import"./chunk-62r4fa4q.js";import"./chunk-32y3767j.js";import"./chunk-ax58cds3.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{Pu as clearScriptScanCache,Qr as convertServerLoopAttributesToDirectives,Fi as convertSignalDirectivesToAttributes,es as convertSignalLoopsToAttributes,ec as extractExports,Ui as findMarkupIndexOutsideScripts,Zr as hasSignalsSyntax,Yr as parseLoopExpression,zi as preEvalLiteralReactiveIfs,Qa as processScriptSetup,Hi as processSignals,tc as rewriteStxImportSpecifiers,Za as scanScriptTags,Fe as stripStxRuntimeImports};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{_o,Ro}from"./chunk-pzngjk81.js";import"./chunk-8vq0qjq9.js";import"./chunk-h1h6xe1k.js";import"./chunk-debz86rr.js";import"./chunk-aync8qmk.js";import"./chunk-bh4x090w.js";import"./chunk-89e1d0rz.js";import"./chunk-qby6wxat.js";import"./chunk-m16h8ea0.js";import"./chunk-3ynkg5dz.js";import"./chunk-014gmm8w.js";import{Js}from"./chunk-cw6j75ck.js";import"./chunk-qx3js9tk.js";import"./chunk-r8wze9ym.js";import"./chunk-hjp990p8.js";import"./chunk-hy9e3ny6.js";import"./chunk-rsxvbnp4.js";import"./chunk-ep5jnqdb.js";import"./chunk-2tfe2g58.js";import"./chunk-10967rws.js";import"./chunk-b1fg9vg7.js";import"./chunk-kea18wnc.js";import"./chunk-34gy5zjm.js";import"./chunk-0varh725.js";import"./chunk-ap6fehea.js";import"./chunk-xvzxrt9a.js";import"./chunk-tqnysw0k.js";import"./chunk-k31fwm2w.js";import"./chunk-4mew0ae3.js";import"./chunk-8j8k27xb.js";import"./chunk-a4r19yxm.js";import"./chunk-awtrcb5m.js";import"./chunk-2ewa2sg5.js";import"./chunk-6aqcgrhw.js";import"./chunk-z0ck9t6j.js";import{me,Yt,Zt,q,d,r,Vn,A,i,ce}from"./chunk-rj3hyqff.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-4e101kjp.js";import"./chunk-62r4fa4q.js";import"./chunk-32y3767j.js";import"./chunk-ax58cds3.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{Vn as buildWebComponents,Zt as cacheTemplate,Yt as checkCache,Js as classifyAllScripts,_o as createMiddleware,Ro as createRoute,A as defaultConfig,d as extractVariables,q as injectRouterScript,i as loadStxConfig,me as processClientScript,r as processDirectives,ce as readMarkdownFile};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Oe,Ua,wu,vu,xu,Su,Va,Wa,ku,Cu,Ni,$u,Yt,Zt,On}from"./chunk-rj3hyqff.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-4e101kjp.js";import"./chunk-62r4fa4q.js";import"./chunk-32y3767j.js";import"./chunk-ax58cds3.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{Su as __setSignalsGeneratorsForTest,Oe as cacheEngineFingerprint,Zt as cacheTemplate,Yt as checkCache,$u as clearDevCaches,Wa as getCachedRouterScript,Va as getCachedSignalsRuntime,ku as getServeClientAsset,Ni as getServeModuleBundle,On as hashFilePath,vu as invalidateFileCache,xu as invalidateFileCacheByDir,wu as readFileCached,Cu as registerServeModuleBundle,Ua as templateCache};
@@ -1,4 +0,0 @@
1
- // @bun
2
- import{Se}from"./chunk-66k7yxnr.js";import{$n,Ut}from"./chunk-8j8k27xb.js";import{Di,Oi,f,vt,M,jn,Bn,Fn,r,Q,A,i}from"./chunk-rj3hyqff.js";import{S}from"./chunk-62r4fa4q.js";import{hs}from"./chunk-4e101kjp.js";import{cn,de}from"./chunk-ax58cds3.js";import{fo}from"./chunk-g1fxmp9z.js";import{ge,re,ei,ti,At}from"./chunk-cw6j75ck.js";import{ht,Br}from"./chunk-z0ck9t6j.js";import{Pt}from"./chunk-mg13q1kd.js";import{ut,Kt,Xt}from"./chunk-jjtzm6dn.js";import m from"fs";import c from"path";import{createHash as ee}from"crypto";function J(o){return ee("sha256").update(o).digest("hex").slice(0,8)}function U(o=!1){let l=o?Ut():$n(),a=J(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function V(){let o=Se(),l=J(o);return{content:o,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as te}from"crypto";function se(o={}){let l=new Set;return{context:new Proxy(o,{get(s,e){if(e in s)return s[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(s,e){if(e in s)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(o,l,a={}){let s=q.resolve(o),e=await Bun.file(s).text(),_=te("sha256").update(e).digest("hex").slice(0,16);Di();let R={};try{R=await i(a.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let v=g[1];if(/\bserver\b/.test(v))y.push(g[2])}let u=new Set(y.flatMap((v)=>Q(v))),{context:w}=se({__filename:s,__dirname:q.dirname(s),__stx_serverDeclared:u}),C=new Set,P={...A,...R,...a,buildMode:"compile",strict:!1},b=await r(e,w,s,P,C),T=ge(b),B=Oi();return{route:l,sourceFile:o,html:b,fragment:T,placeholders:B,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(C),contentHash:_,status:vt(e),streamTemplates:w.__streamTemplates}}var ne=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(o,l){let a=0,s=0;if(!m.existsSync(o))return{copied:a,bytes:s};m.mkdirSync(l,{recursive:!0});function e(_,R){let y=m.readdirSync(_,{withFileTypes:!0});for(let d of y){if(ne.has(d.name))continue;let g=c.join(_,d.name),u=c.join(R,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),a++,s+=m.statSync(u).size}}}return e(o,l),{copied:a,bytes:s}}async function Vc(o={}){let l=Date.now(),a=c.resolve(o.root||process.cwd()),s=c.resolve(a,o.outputDir||".output");console.log("[stx build] Starting production build...");let e=await i(a),_=c.resolve(a,o.componentsDir??e.componentsDir??"components"),R=c.resolve(a,o.partialsDir??e.partialsDir??"partials"),y=c.resolve(a,o.layoutsDir??e.layoutsDir??"layouts"),d=o.publicDir??e.publicDir??"public",g=de(e.app?.head,{known:cn,source:"app.head"}),u=e.app?.colorMode,w=e.router?.container||"main",C=o.routeRules??e.routeRules??{},P=Pt(C),b=o.serverApi??e.serverApi,T=typeof b==="object"?b:{};if(b)ht(a,T);if(e.runtimeConfig)S(e.runtimeConfig,{});if(m.existsSync(s))m.rmSync(s,{recursive:!0});let B=[c.join(s,"public","__stx"),c.join(s,"public","assets"),c.join(s,"server","pages"),c.join(s,"server","fragments")];for(let n of B)m.mkdirSync(n,{recursive:!0});console.log("[stx build] Discovering routes...");let v=M(a,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],O=v.filter((n)=>!Y.some((h)=>n.pattern.startsWith(`/${h}/`)||n.pattern===`/${h}`));console.log(`[stx build] Found ${O.length} page routes (${v.length-O.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let D=U(o.debug),x=V();await Bun.write(c.join(s,"public","__stx",D.filename),D.content),await Bun.write(c.join(s,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${D.filename} (${(D.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let k=[],H=[];for(let n of O){let h=P(n.pattern),E=h.rendering==="prerender";if(E&&(n.pattern.includes(":")||n.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${n.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(n.filePath,n.pattern,{configDir:a,componentsDir:_,partialsDir:R,layoutsDir:y,debug:o.debug});if(k.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,D.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Fn(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=jn(t.html,u);if(g.htmlAttrs)t.html=Bn(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await f(t.html),E){let p=await At(t,{params:{},request:new Request(`http://stx.build${n.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${n.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=re(t.html,w);let z=n.pattern==="/"?"index":n.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),G=c.join("server","pages",`${z}.compiled.json`),I=c.join("server","fragments",`${z}.html`);await Bun.write(c.join(s,G),JSON.stringify(t,null,2)),await Bun.write(c.join(s,I),t.fragment),H.push({pattern:n.pattern,compiledPath:G,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:n.pattern.includes(":")||n.pattern.includes("["),prerendered:E}),console.log(`[stx build] \u2713 ${n.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${n.pattern}:`,t instanceof Error?t.message:t)}}let F=c.resolve(a,d);if(m.existsSync(F)){let{copied:n,bytes:h}=Z(F,c.join(s,"public"));if(n>0)console.log(`[stx build] Copied ${n} public asset${n===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let N=Xt(a);if(N){let{copied:n,bytes:h}=Z(N,c.join(s,"public",Kt));if(n>0)console.log(`[stx build] Copied ${n} asset${n===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${ut}/`)}let K={runtime:D.filename,router:x.filename},j=ei(H,K,s);if(j.routeRules=C,j.routerContainer=w,b)j.apiRoutes=await Br(a,s,T);if(e.runtimeConfig)await Bun.write(c.join(s,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await hs(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(s,"server/layers.json"),JSON.stringify(fo(e._layerGraph),null,2));ti(j,s);let L=Date.now()-l;return console.log(`
3
- [stx build] Done in ${L}ms \u2014 ${k.length} pages compiled`),{pageCount:k.length,assets:K,outputDir:s,duration:L}}
4
- export{Vc};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{pr,Us,wn,fr,gr,_t,ct,Vs,vn,xn,mr,hr,Nc,Lc,Te}from"./chunk-8vq0qjq9.js";export{Te as DeployError,Us as calculateSha1,wn as collectDeployFiles,xn as createDefaultNetlifyConfig,fr as createFileManifest,pr as createNetlifyClient,Nc as deploy,vn as detectProjectConfig,gr as filterRequiredFiles,_t as formatSize,Vs as generateNetlifyToml,ct as getTotalSize,hr as hasNetlifyConfig,Lc as initNetlify,mr as writeNetlifyConfig};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Ps}from"./chunk-4n6c5rp5.js";export{Ps as warnUnbalancedTags};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{oa,aa,ca,la,ua,da,pa,fa,ga,ma,ll}from"./chunk-2tfe2g58.js";export{oa as createIslandRegistry,ll as default,ma as generateIslandManifest,ca as generatePartialHydrationCSS,da as hydrateAll,ua as hydrateByStrategy,la as hydrateIsland,pa as isHydrated,fa as onHydrated,aa as processPartialHydrationDirectives,ga as processStaticDirectives};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{_s,Rs,Ye,X,fn,nr,gn,rr,sr,kc,Cc,$c,mn,Ec,Tc,_c,Rc,Co,$o,Eo,As,To,Ac,Ze,Qe,et,tt,nt,rt,Se,Pc}from"./chunk-66k7yxnr.js";export{gn as Router,_c as abortNavigation,nr as bracketPathToRegex,Ze as clearMiddleware,$o as createClientCookieManager,nt as createMiddlewareContext,tt as createRouteLocation,Co as createServerCookieManager,Eo as createStorageManager,Rc as defineMiddleware,Cc as defineRoute,$c as defineRoutes,rr as findErrorPage,sr as formatRoutes,Rs as generateRouteManifest,_s as generateRouteTypes,To as getMiddleware,Qe as getMiddlewareNames,Se as getRouterScript,Pc as getRouterScriptDev,Ac as hasMiddleware,Ye as isFileRequestPath,et as loadMiddlewareFromDirectory,fn as matchRoute,Tc as navigateTo,X as patternToRegex,As as registerMiddleware,Ec as resetRoutes,mn as route,rt as runMiddleware,kc as setAppUrl};