@stacksjs/stx 0.2.795 → 0.2.798

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 (220) hide show
  1. package/dist/{chunk-y64f5t74.js → chunk-0beyn8ak.js} +5 -5
  2. package/dist/{chunk-jmbh26gv.js → chunk-0gsq8gps.js} +1 -1
  3. package/dist/chunk-0xnvjw7s.js +2 -0
  4. package/dist/chunk-1wyccmsr.js +2 -0
  5. package/dist/{chunk-4s0ye933.js → chunk-20yz8bjp.js} +2 -2
  6. package/dist/{chunk-bzhzp4f4.js → chunk-2ws2qe1k.js} +2 -2
  7. package/dist/{chunk-2bvaakcv.js → chunk-2z2bq2at.js} +3 -3
  8. package/dist/chunk-31qjy9xr.js +2 -0
  9. package/dist/chunk-33devn0s.js +2 -0
  10. package/dist/{chunk-baj6w8ja.js → chunk-33vr7x2t.js} +3 -3
  11. package/dist/chunk-33wpv2n1.js +2 -0
  12. package/dist/{chunk-aksrh8je.js → chunk-3mby4nes.js} +3 -3
  13. package/dist/chunk-3p5gxc6t.js +2 -0
  14. package/dist/{chunk-88acqv2r.js → chunk-3x598qjt.js} +4 -4
  15. package/dist/chunk-4hgz9dkv.js +2 -0
  16. package/dist/{chunk-7k6hd10j.js → chunk-4sesw88b.js} +5 -5
  17. package/dist/{chunk-624xpap6.js → chunk-4v50nafp.js} +13 -13
  18. package/dist/chunk-5kc9kjaa.js +2 -0
  19. package/dist/{chunk-2e5tvryz.js → chunk-5wwcgze3.js} +2 -2
  20. package/dist/chunk-5xd53dwe.js +2 -0
  21. package/dist/chunk-5y6518h8.js +2 -0
  22. package/dist/chunk-5y77pe7b.js +2 -0
  23. package/dist/chunk-6a97a9wk.js +2 -0
  24. package/dist/{chunk-xqjat573.js → chunk-6b5zhtb3.js} +2 -2
  25. package/dist/chunk-6hre8cg4.js +2 -0
  26. package/dist/{chunk-vpzdqbw7.js → chunk-6m4y5dh5.js} +6 -6
  27. package/dist/chunk-6pyweb05.js +2 -0
  28. package/dist/chunk-6tp7ys77.js +2 -0
  29. package/dist/chunk-6zxzr20d.js +2 -0
  30. package/dist/chunk-75ctpxr3.js +2 -0
  31. package/dist/{chunk-tmfrq4nq.js → chunk-7bxnjr3b.js} +7 -7
  32. package/dist/chunk-7gw96jpj.js +2 -0
  33. package/dist/chunk-7m4eesp0.js +2 -0
  34. package/dist/chunk-7na8bets.js +2 -0
  35. package/dist/{chunk-6s9bk98p.js → chunk-7yb82rm6.js} +2 -2
  36. package/dist/{chunk-dstzvtvk.js → chunk-810r5dk3.js} +3 -3
  37. package/dist/{chunk-njk5db1q.js → chunk-89jn2jmf.js} +4 -4
  38. package/dist/{chunk-nyer6v3y.js → chunk-8bzq2z0m.js} +5 -5
  39. package/dist/chunk-8k2n6abg.js +2 -0
  40. package/dist/chunk-8vqs94f3.js +2 -0
  41. package/dist/{chunk-3em44jbm.js → chunk-91htcq62.js} +2 -2
  42. package/dist/chunk-9736003n.js +2 -0
  43. package/dist/{chunk-p3ej3954.js → chunk-9b6896tb.js} +2 -2
  44. package/dist/{chunk-pnddmgjf.js → chunk-9k6tza24.js} +7 -7
  45. package/dist/chunk-9w33k6f7.js +2 -0
  46. package/dist/{chunk-g4n0bjfb.js → chunk-9x62j5f0.js} +10 -10
  47. package/dist/{chunk-1q16p7t2.js → chunk-a1ba9d2r.js} +5 -5
  48. package/dist/{chunk-8t8e75xm.js → chunk-a20wq8wf.js} +4 -4
  49. package/dist/{chunk-7y73txmp.js → chunk-a3xqfyb6.js} +2 -2
  50. package/dist/chunk-ag8j9ec2.js +2 -0
  51. package/dist/chunk-ak15dt1a.js +2 -0
  52. package/dist/{chunk-qnxctfdf.js → chunk-akcyaxwv.js} +2 -2
  53. package/dist/{chunk-f4j7nsj1.js → chunk-aw6369cx.js} +1 -1
  54. package/dist/{chunk-ennzzth4.js → chunk-b5ck6epd.js} +17 -17
  55. package/dist/chunk-b98743ja.js +2 -0
  56. package/dist/{chunk-3vpgr6nk.js → chunk-b9d70mgr.js} +3 -3
  57. package/dist/chunk-bskxswmn.js +2 -0
  58. package/dist/chunk-bv5h4etd.js +2 -0
  59. package/dist/chunk-c7x3bmvs.js +2 -0
  60. package/dist/{chunk-12jjf2me.js → chunk-c84pxd2k.js} +2 -2
  61. package/dist/chunk-camm2hcx.js +2 -0
  62. package/dist/chunk-cd2wda5c.js +2 -0
  63. package/dist/chunk-cv6pqg85.js +2 -0
  64. package/dist/chunk-cy0mab8y.js +2 -0
  65. package/dist/chunk-d554f2fj.js +2 -0
  66. package/dist/chunk-dd1vqndp.js +2 -0
  67. package/dist/{chunk-cfbpvm5e.js → chunk-ddhkhhc7.js} +2 -2
  68. package/dist/{chunk-thpwk6ya.js → chunk-dsnggn3g.js} +2 -2
  69. package/dist/chunk-e14v1q9c.js +2 -0
  70. package/dist/{chunk-hp10khyy.js → chunk-e37g6ezw.js} +20 -20
  71. package/dist/chunk-e3xw2bzh.js +2 -0
  72. package/dist/{chunk-pm8a4kdf.js → chunk-eegb7f3t.js} +5 -5
  73. package/dist/chunk-eeztqt6f.js +2 -0
  74. package/dist/{chunk-7s1kerhs.js → chunk-ef3w5thv.js} +2 -2
  75. package/dist/chunk-eh528njb.js +2 -0
  76. package/dist/{chunk-wzwfbehm.js → chunk-en0wry1c.js} +11 -11
  77. package/dist/chunk-eszpqrxy.js +2 -0
  78. package/dist/{chunk-dxe94pwy.js → chunk-fp0ew9n4.js} +4 -4
  79. package/dist/chunk-fyxkzs9c.js +2 -0
  80. package/dist/{chunk-hwcfgs3e.js → chunk-gjf8cjdt.js} +3 -3
  81. package/dist/{chunk-8zf87cc5.js → chunk-gvnfb6s2.js} +2 -2
  82. package/dist/{chunk-fcqxa38q.js → chunk-gzfvj15b.js} +1 -1
  83. package/dist/chunk-hb4jkdfr.js +2 -0
  84. package/dist/{chunk-r3a15pax.js → chunk-hg9mwgnr.js} +1 -1
  85. package/dist/{chunk-reb7rddz.js → chunk-hmt0vqhb.js} +1 -1
  86. package/dist/{chunk-r1vkk7qp.js → chunk-hp9e8nz6.js} +2 -2
  87. package/dist/chunk-hzps1xya.js +2 -0
  88. package/dist/{chunk-4p5g7v9g.js → chunk-j3st59hv.js} +2 -2
  89. package/dist/{chunk-zva4a7xq.js → chunk-jde0shn4.js} +2 -2
  90. package/dist/{chunk-2xprqx2v.js → chunk-jeprxn45.js} +6 -6
  91. package/dist/{chunk-d50vw81s.js → chunk-jt0yn7ab.js} +4 -4
  92. package/dist/chunk-k8gpvg0w.js +2 -0
  93. package/dist/chunk-kgn911k7.js +2 -0
  94. package/dist/{chunk-1hq3y7ss.js → chunk-kj8dvzpc.js} +2 -2
  95. package/dist/chunk-km8c0j9g.js +2 -0
  96. package/dist/{chunk-ayd635jf.js → chunk-mj3hzy1e.js} +5 -5
  97. package/dist/{chunk-9jcqbgq9.js → chunk-nw0v655w.js} +6 -6
  98. package/dist/{chunk-ata5wp2m.js → chunk-p1mghe1h.js} +6 -6
  99. package/dist/{chunk-rdymnn2t.js → chunk-p2a6dwj6.js} +6 -6
  100. package/dist/chunk-pw89m3re.js +2 -0
  101. package/dist/chunk-q38vjqv2.js +2 -0
  102. package/dist/{chunk-9b9tvhmh.js → chunk-q3ma4khe.js} +5 -5
  103. package/dist/{chunk-3f8w1x6w.js → chunk-q7q9e0gj.js} +7 -7
  104. package/dist/{chunk-7y29q1ng.js → chunk-qef2vv0m.js} +2 -2
  105. package/dist/{chunk-6wpwpk3c.js → chunk-qjbpa1n4.js} +4 -4
  106. package/dist/{chunk-y2jqx5k4.js → chunk-qm2wmqre.js} +1 -1
  107. package/dist/{chunk-53v4cby3.js → chunk-qpvwxppw.js} +4 -4
  108. package/dist/{chunk-427mhgje.js → chunk-qxt6hdat.js} +1 -1
  109. package/dist/{chunk-w6e30qkz.js → chunk-r6d6jphq.js} +20 -20
  110. package/dist/{chunk-538d185r.js → chunk-rbv6fxtx.js} +2 -2
  111. package/dist/chunk-rrketemm.js +2 -0
  112. package/dist/chunk-rwys552r.js +3 -0
  113. package/dist/chunk-s0bx4gjh.js +2 -0
  114. package/dist/{chunk-90zswh9v.js → chunk-s14jcqdf.js} +4 -4
  115. package/dist/{chunk-bwf8b4e4.js → chunk-s3fmmm98.js} +3 -3
  116. package/dist/chunk-s8s7b7rv.js +2 -0
  117. package/dist/{chunk-vkn133cs.js → chunk-s9b6abkb.js} +2 -2
  118. package/dist/{chunk-w76cve9j.js → chunk-sprgkk9j.js} +31 -31
  119. package/dist/chunk-sywqa4da.js +2 -0
  120. package/dist/{chunk-b58n1kfe.js → chunk-t65tn8ee.js} +2 -2
  121. package/dist/{chunk-ka8sk5qa.js → chunk-trjhz9d9.js} +1 -1
  122. package/dist/chunk-txrbz95y.js +2 -0
  123. package/dist/{chunk-yjnaqahd.js → chunk-v9hm1xv6.js} +5 -5
  124. package/dist/{chunk-c5vzr1va.js → chunk-w0zayhmg.js} +2 -2
  125. package/dist/{chunk-h656zg6k.js → chunk-w58bnt44.js} +3 -3
  126. package/dist/chunk-w7681v48.js +2 -0
  127. package/dist/chunk-w7wz670a.js +2 -0
  128. package/dist/{chunk-zmr0pvcd.js → chunk-wp6bdac7.js} +59 -59
  129. package/dist/{chunk-cepctq7e.js → chunk-x8ckxemg.js} +23 -23
  130. package/dist/{chunk-mcj5qtpp.js → chunk-xa36escd.js} +3 -3
  131. package/dist/{chunk-wa7fzgw7.js → chunk-xskswvef.js} +4 -4
  132. package/dist/chunk-xzgtdcbg.js +2 -0
  133. package/dist/{chunk-7xs45trj.js → chunk-y9bj3566.js} +2 -2
  134. package/dist/chunk-yfdb3x3p.js +2 -0
  135. package/dist/{chunk-azqf0ps0.js → chunk-yv4dwdhc.js} +2 -2
  136. package/dist/{chunk-m081078c.js → chunk-z1aq59qj.js} +3 -3
  137. package/dist/{chunk-axjfaere.js → chunk-z1fb5k3h.js} +127 -40
  138. package/dist/{chunk-tqvw1673.js → chunk-z8wfvqbk.js} +5 -5
  139. package/dist/chunk-z9a80qqg.js +2 -0
  140. package/dist/chunk-za5kx15m.js +2 -0
  141. package/dist/{chunk-hnbx1t3t.js → chunk-zbv8e4rq.js} +2 -2
  142. package/dist/{chunk-sphc7xzx.js → chunk-znx5m1jv.js} +1 -1
  143. package/dist/{chunk-zv3zpmv1.js → chunk-zqsacq3r.js} +1 -1
  144. package/dist/{chunk-ectx5ar9.js → chunk-zsy145ac.js} +3 -3
  145. package/dist/{chunk-x8ghjw9b.js → chunk-zx8tnhfr.js} +3 -3
  146. package/dist/cli.js +18 -18
  147. package/dist/client/signals-authoring-runtime.js +4 -1
  148. package/dist/client/signals-handler-runtime.js +25 -4
  149. package/dist/client/signals-helpers-runtime.js +12 -0
  150. package/dist/client/signals-native-row-runtime.js +58 -23
  151. package/dist/client/signals-pipe-runtime.js +16 -0
  152. package/dist/craft-entry.js +2 -2
  153. package/dist/craft.js +2 -2
  154. package/dist/native/compiler/inline-style.js +91 -39
  155. package/dist/native/runtime/native-host.js +138 -17
  156. package/dist/native-build.js +2 -23
  157. package/dist/pwa.js +3 -3
  158. package/dist/ssg.js +5 -5
  159. package/package.json +6 -6
  160. package/dist/chunk-027hdpgv.js +0 -2
  161. package/dist/chunk-054h7ktz.js +0 -2
  162. package/dist/chunk-09nyt9c5.js +0 -2
  163. package/dist/chunk-0d3ncyqh.js +0 -2
  164. package/dist/chunk-1yew6rw9.js +0 -2
  165. package/dist/chunk-211kxm18.js +0 -2
  166. package/dist/chunk-26y92p8r.js +0 -2
  167. package/dist/chunk-3ep9h16p.js +0 -2
  168. package/dist/chunk-49tn6yst.js +0 -2
  169. package/dist/chunk-4b7dwwn6.js +0 -2
  170. package/dist/chunk-4ncbq4bx.js +0 -2
  171. package/dist/chunk-4srnxp3b.js +0 -2
  172. package/dist/chunk-6z4bza9z.js +0 -2
  173. package/dist/chunk-75y9heas.js +0 -2
  174. package/dist/chunk-7ckdvsmj.js +0 -3
  175. package/dist/chunk-8w1wxr96.js +0 -2
  176. package/dist/chunk-98kjk52z.js +0 -2
  177. package/dist/chunk-9sea317f.js +0 -2
  178. package/dist/chunk-9tpv4cg7.js +0 -2
  179. package/dist/chunk-9wmjmas8.js +0 -2
  180. package/dist/chunk-ak10vygz.js +0 -2
  181. package/dist/chunk-axq3c7cb.js +0 -2
  182. package/dist/chunk-c5trhqpg.js +0 -2
  183. package/dist/chunk-c692kj5v.js +0 -2
  184. package/dist/chunk-cfr7cd88.js +0 -2
  185. package/dist/chunk-dsh5q9bg.js +0 -2
  186. package/dist/chunk-emnphnz7.js +0 -2
  187. package/dist/chunk-epcdgn78.js +0 -2
  188. package/dist/chunk-etegf4zj.js +0 -2
  189. package/dist/chunk-ewzdsksb.js +0 -2
  190. package/dist/chunk-ey8bgg6x.js +0 -2
  191. package/dist/chunk-f03sg8b0.js +0 -2
  192. package/dist/chunk-gf04pgaa.js +0 -2
  193. package/dist/chunk-ghn8vhet.js +0 -2
  194. package/dist/chunk-gywp6kd8.js +0 -2
  195. package/dist/chunk-k6sjqb7g.js +0 -2
  196. package/dist/chunk-me71d5w5.js +0 -2
  197. package/dist/chunk-nvytej81.js +0 -2
  198. package/dist/chunk-p1txw41y.js +0 -2
  199. package/dist/chunk-p8gekf4b.js +0 -2
  200. package/dist/chunk-px0qsd38.js +0 -2
  201. package/dist/chunk-qr23snrp.js +0 -2
  202. package/dist/chunk-s151a2dj.js +0 -2
  203. package/dist/chunk-sqettc34.js +0 -2
  204. package/dist/chunk-srgbv05n.js +0 -2
  205. package/dist/chunk-t0d4rsfx.js +0 -2
  206. package/dist/chunk-t0k0yk24.js +0 -2
  207. package/dist/chunk-tdcgskyy.js +0 -2
  208. package/dist/chunk-te3hr6d7.js +0 -2
  209. package/dist/chunk-tes8fdv6.js +0 -2
  210. package/dist/chunk-v6j5vkce.js +0 -2
  211. package/dist/chunk-vmp876q6.js +0 -2
  212. package/dist/chunk-vwp5fchy.js +0 -2
  213. package/dist/chunk-wes5fdpe.js +0 -2
  214. package/dist/chunk-wfnfb4fr.js +0 -2
  215. package/dist/chunk-wfrqwtar.js +0 -2
  216. package/dist/chunk-xbhb8102.js +0 -2
  217. package/dist/chunk-xv4paxmt.js +0 -2
  218. package/dist/chunk-yeaqebnd.js +0 -2
  219. package/dist/chunk-yj20tq3s.js +0 -2
  220. package/dist/chunk-yjm7c78z.js +0 -2
@@ -1,4 +1,4 @@
1
- import { accessibilityChanges, authoredAccessibilityProps, projectAccessibility } from "../accessibility.js";
1
+ import { ACCESSIBILITY_FIELDS, accessibilityChanges, authoredAccessibilityProps, isAccessibilityAttribute, projectAccessibility } from "../accessibility.js";
2
2
  import { seedClassTable } from "../compiler/class-table.js";
3
3
  import { compileClassStyles, NATIVE_STATE_VARIANTS } from "../compiler/headwind-to-style.js";
4
4
  import { resolveIconName } from "../compiler/icons.js";
@@ -82,6 +82,28 @@ function flatName(name) {
82
82
  }
83
83
  return flat;
84
84
  }
85
+ const nativeEventNames = new Map;
86
+ function nativeEventName(event) {
87
+ let name = nativeEventNames.get(event);
88
+ if (name === void 0) {
89
+ name = NATIVE_EVENT_NAMES[event.toLowerCase()] ?? event;
90
+ if (nativeEventNames.size >= 2000)
91
+ nativeEventNames.clear();
92
+ nativeEventNames.set(event, name);
93
+ }
94
+ return name;
95
+ }
96
+ const scriptEventNames = new Map;
97
+ function scriptOnlyEvent(event) {
98
+ let only = scriptEventNames.get(event);
99
+ if (only === void 0) {
100
+ only = NATIVE_EVENT_NAMES[event.toLowerCase()] === void 0 && !/^on[A-Z]/.test(event);
101
+ if (scriptEventNames.size >= 2000)
102
+ scriptEventNames.clear();
103
+ scriptEventNames.set(event, only);
104
+ }
105
+ return only;
106
+ }
85
107
  function followsHref() {}
86
108
  export function createNativeHost(options) {
87
109
  const records = new Map, attributeObservers = new WeakMap, childObservers = new WeakMap, handlers = new Map, eventRegistrations = new WeakMap, componentListeners = new WeakMap, controlsWithDefaultListeners = new WeakSet, implicitSubmitListeners = new WeakMap, formResetCallbacks = new WeakMap, boundHrefs = new WeakMap;
@@ -312,6 +334,24 @@ export function createNativeHost(options) {
312
334
  function hostProps(record) {
313
335
  return { ...record.props, ...projectAccessibility(record.props, record.type), ...projectTextEntry(record.type, record.props) };
314
336
  }
337
+ function createdProps(record) {
338
+ const props = record.props, created = {};
339
+ let accessible = record.type === "Image";
340
+ const names = Object.keys(props);
341
+ for (let i = 0;i < names.length; i++) {
342
+ const name = names[i], first = name.charCodeAt(0);
343
+ if (first === 100 ? name.startsWith("data-stx-") && name !== "data-stx-component-wrapper" : name === "__stxId")
344
+ continue;
345
+ if (!accessible && (first === 97 || first === 114))
346
+ accessible = isAccessibilityAttribute(name) || ACCESSIBILITY_FIELDS.includes(name);
347
+ created[name] = props[name];
348
+ }
349
+ if (accessible)
350
+ Object.assign(created, projectAccessibility(props, record.type));
351
+ if (record.type === "TextInput")
352
+ Object.assign(created, projectTextEntry(record.type, props));
353
+ return created;
354
+ }
315
355
  function ariaState(value) {
316
356
  return value === !0 || value === "true";
317
357
  }
@@ -375,7 +415,7 @@ export function createNativeHost(options) {
375
415
  let delegatedPress = !1;
376
416
  if (pressable) {
377
417
  for (let owner = node.__stxOwner;owner; owner = owner.__stxOwner)
378
- if (componentListeners.get(owner)?.some((listener) => (NATIVE_EVENT_NAMES[listener.event.toLowerCase()] ?? listener.event) === "onPress")) {
418
+ if (componentListeners.get(owner)?.some((listener) => nativeEventName(listener.event) === "onPress")) {
379
419
  delegatedPress = !0;
380
420
  break;
381
421
  }
@@ -401,7 +441,7 @@ export function createNativeHost(options) {
401
441
  } else if (!eligible && previous) {
402
442
  previous.stop();
403
443
  implicitSubmitListeners.delete(node);
404
- if (!componentListeners.get(node)?.some((listener) => (NATIVE_EVENT_NAMES[listener.event.toLowerCase()] ?? listener.event) === "onSubmitEditing")) {
444
+ if (!componentListeners.get(node)?.some((listener) => nativeEventName(listener.event) === "onSubmitEditing")) {
405
445
  const id = record.events.onSubmitEditing;
406
446
  if (id)
407
447
  handlers.delete(id);
@@ -428,7 +468,7 @@ export function createNativeHost(options) {
428
468
  node: {
429
469
  type: record.type,
430
470
  ...record.key === void 0 ? {} : { key: record.key },
431
- props: hostProps(record),
471
+ props: createdProps(record),
432
472
  style: { ...record.style },
433
473
  ...Object.keys(record.events).length ? { events: { ...record.events } } : {},
434
474
  ...record.text === void 0 ? {} : { children: [record.text] }
@@ -445,7 +485,24 @@ export function createNativeHost(options) {
445
485
  let resolvingId = "";
446
486
  const reportStyle = (diagnostic) => {
447
487
  console.warn(`[STX Native] ${diagnostic.kind}: ${resolvingId}: ${diagnostic.name}`);
448
- }, NO_LAYERS = [];
488
+ }, NO_LAYERS = [], classMemos = new Map;
489
+ function classStylesOf(record, forStyle) {
490
+ const classes = record.forwardedClasses === void 0 ? `${record.classes} ` : `${record.classes} ${record.forwardedClasses}`, source = record.type === "TextInput" ? `\x01${classes}` : classes;
491
+ let memo = record.classMemo;
492
+ if (!memo || memo.source !== source || memo.variables !== record.variables || memo.scheme !== colorScheme) {
493
+ memo = classMemos.get(source);
494
+ if (!memo || memo.variables !== record.variables || memo.scheme !== colorScheme) {
495
+ memo = { source, variables: record.variables, scheme: colorScheme };
496
+ if (classMemos.size >= 2000)
497
+ classMemos.clear();
498
+ classMemos.set(source, memo);
499
+ }
500
+ record.classMemo = memo;
501
+ }
502
+ if (forStyle)
503
+ return memo.style ??= compileClassStyles(classes, record.variables, { focus: record.type === "TextInput", focusWithin: !0, rules: options.stylesheetRules, appearance: colorScheme, pointer: options.pointer === !0 });
504
+ return memo.props ??= compileClassStyles(classes, record.variables, { focus: record.type === "TextInput", focusWithin: !0, rules: options.stylesheetRules });
505
+ }
449
506
  function resolveStyle(record, id) {
450
507
  resolvingId = id;
451
508
  const report = reportStyle;
@@ -456,7 +513,30 @@ export function createNativeHost(options) {
456
513
  inherited = parseNativeStyleLayers([ancestors[i]], inherited, report).variables;
457
514
  const resolved = parseNativeStyleLayers([record.styleSource, record.boundStyle, record.forwardedStyle], inherited, report);
458
515
  record.variables = resolved.variables;
459
- const classes = compileClassStyles(`${record.classes} ${record.forwardedClasses ?? ""}`, record.variables, { focus: record.type === "TextInput", focusWithin: !0, rules: options.stylesheetRules, appearance: colorScheme, pointer: options.pointer === !0 }), classStyle = { ...classes.style };
516
+ const classes = classStylesOf(record, !0), plain = !classes.responsive?.length && !classes.states && !classes.disabled && !record.focusWithin && !record.focused && record.dividerStyle === void 0 && isBlank(record.layoutDefaults) && isBlank(record.baseStyle) && !isHiddenInput(record);
517
+ let kept;
518
+ const keptAs = `${colorScheme}${record.visible ? 1 : 0}`;
519
+ if (plain) {
520
+ let byFirst = resolvedStyles.get(classes);
521
+ if (!byFirst)
522
+ resolvedStyles.set(classes, byFirst = new WeakMap);
523
+ const first = layerKey(resolved.styles[0]);
524
+ let bySecond = byFirst.get(first);
525
+ if (!bySecond)
526
+ byFirst.set(first, bySecond = new WeakMap);
527
+ const second = layerKey(resolved.styles[1]);
528
+ let byThird = bySecond.get(second);
529
+ if (!byThird)
530
+ bySecond.set(second, byThird = new WeakMap);
531
+ const third = layerKey(resolved.styles[2]);
532
+ kept = byThird.get(third);
533
+ if (!kept)
534
+ byThird.set(third, kept = new Map);
535
+ const known = kept.get(keptAs);
536
+ if (known)
537
+ return { ...known };
538
+ }
539
+ const classStyle = { ...classes.style };
460
540
  for (const layer of classes.responsive ?? []) {
461
541
  widthBounds.min.add(layer.min);
462
542
  if (layer.max !== void 0)
@@ -495,8 +575,17 @@ export function createNativeHost(options) {
495
575
  style.pressStyle = { ...active.style, ...colorScheme === "dark" ? active.dark : {} };
496
576
  if (!record.visible || isHiddenInput(record))
497
577
  style.display = "none";
578
+ if (kept)
579
+ kept.set(keptAs, { ...style });
498
580
  return style;
499
581
  }
582
+ const resolvedStyles = new WeakMap, BLANK_LAYER = {};
583
+ function layerKey(style) {
584
+ return !style || isBlank(style) ? BLANK_LAYER : style;
585
+ }
586
+ function isBlank(value) {
587
+ return !value || Object.keys(value).length === 0;
588
+ }
500
589
  function refreshFocusChain(node) {
501
590
  for (let current = node;current; current = current.__stxOwner) {
502
591
  const record = descriptorOf(current);
@@ -611,7 +700,7 @@ export function createNativeHost(options) {
611
700
  emit({ op: "updateNode", id, patch: { style: { ...patch, ...style } } });
612
701
  }
613
702
  record.style = style;
614
- const classes = compileClassStyles(`${record.classes} ${record.forwardedClasses ?? ""}`, record.variables, { focus: record.type === "TextInput", focusWithin: !0, rules: options.stylesheetRules }), divideChanged = classes.divide !== record.divide && JSON.stringify(classes.divide) !== JSON.stringify(record.divide);
703
+ const classes = classStylesOf(record, !1), divideChanged = classes.divide !== record.divide && JSON.stringify(classes.divide) !== JSON.stringify(record.divide);
615
704
  record.divide = classes.divide;
616
705
  if (divideChanged || record.divide)
617
706
  refreshDividersOf(record);
@@ -661,6 +750,9 @@ export function createNativeHost(options) {
661
750
  visit(node);
662
751
  return out;
663
752
  }
753
+ function componentEventOnly(node, event) {
754
+ return isBindingNode(node) && node.hasAttribute("data-stx-component-wrapper") && scriptOnlyEvent(event);
755
+ }
664
756
  function isBindingNode(node) {
665
757
  return node.nodeType === 1;
666
758
  }
@@ -834,7 +926,16 @@ export function createNativeHost(options) {
834
926
  own.styleDirty = !0;
835
927
  }
836
928
  insertIntoBindingParent(parent, node, index);
837
- setConnected(node, !1);
929
+ }
930
+ const plainProps = new Map;
931
+ function plainProp(prop, type) {
932
+ const key = `${type}\x01${prop}`;
933
+ let plain = plainProps.get(key);
934
+ if (plain === void 0) {
935
+ plain = !(type === "Image" && prop === "alt" || prop === "role" || prop.startsWith("aria-") || prop.startsWith("accessibility") || TEXT_ENTRY_SOURCES.has(prop) || prop === "multiline" || prop === "disabled" || NATIVE_STATE_VARIANTS.has(prop) || type === "Icon" && prop === "name" || prop === "href" || SVG_NODE_TYPES.has(type));
936
+ plainProps.set(key, plain);
937
+ }
938
+ return plain;
838
939
  }
839
940
  function copyNode(node, source, copy) {
840
941
  if (!isBindingNode(node))
@@ -1030,7 +1131,8 @@ export function createNativeHost(options) {
1030
1131
  const forwarded = forwardedHostRoot(node, name);
1031
1132
  reflectAttribute(node, name, value);
1032
1133
  if (forwarded) {
1033
- reflectAttribute(forwarded, name, value);
1134
+ if (forwarded !== node)
1135
+ reflectAttribute(forwarded, name, value);
1034
1136
  if (applyForwardedStyle(forwarded, name, value))
1035
1137
  return;
1036
1138
  node = forwarded;
@@ -1042,7 +1144,18 @@ export function createNativeHost(options) {
1042
1144
  applyClasses(node.__stxId, record);
1043
1145
  return;
1044
1146
  }
1045
- const record = recordOf(node), prop = nativePropName(name, record.type), accessibilityBefore = record.type === "Image" && prop === "alt" || prop === "role" || prop.startsWith("aria-") || prop.startsWith("accessibility") ? projectAccessibility(record.props, record.type) : void 0, textEntryBefore = TEXT_ENTRY_SOURCES.has(prop) ? projectTextEntry(record.type, record.props) : void 0, wasDisabled = disabled(record);
1147
+ const record = recordOf(node), prop = nativePropName(name, record.type);
1148
+ if (plainProp(prop, record.type)) {
1149
+ record.props[prop] = value;
1150
+ if (record.focused && disabled(record)) {
1151
+ record.focused = !1;
1152
+ refreshFocusChain(node);
1153
+ }
1154
+ if (record.materialized)
1155
+ emit({ op: "updateNode", id: node.__stxId, patch: { props: { [prop]: value } } });
1156
+ return;
1157
+ }
1158
+ const accessibilityBefore = record.type === "Image" && prop === "alt" || prop === "role" || prop.startsWith("aria-") || prop.startsWith("accessibility") ? projectAccessibility(record.props, record.type) : void 0, textEntryBefore = TEXT_ENTRY_SOURCES.has(prop) ? projectTextEntry(record.type, record.props) : void 0, wasDisabled = disabled(record);
1046
1159
  record.props[prop] = value;
1047
1160
  if (TEXT_ENTRY_SOURCES.has(prop) || prop === "multiline")
1048
1161
  syncImplicitSubmit(node);
@@ -1196,15 +1309,23 @@ export function createNativeHost(options) {
1196
1309
  listen(node, event, handler, options) {
1197
1310
  if (disposed)
1198
1311
  return () => {};
1199
- const listenerOptions = options, listeners = componentListeners.get(node) ?? [], listener = { event, handler, once: !!listenerOptions?.once, capture: !!listenerOptions?.capture };
1312
+ const listenerOptions = options;
1313
+ let listeners = componentListeners.get(node);
1314
+ if (!listeners)
1315
+ componentListeners.set(node, listeners = []);
1316
+ const listener = { event, handler, once: !!listenerOptions?.once, capture: !!listenerOptions?.capture };
1200
1317
  listeners.push(listener);
1201
- componentListeners.set(node, listeners);
1202
1318
  const unsubscribe = () => {
1203
1319
  const index = listeners.indexOf(listener);
1204
1320
  if (index !== -1)
1205
1321
  listeners.splice(index, 1);
1206
- }, nativeEvent = NATIVE_EVENT_NAMES[event.toLowerCase()] ?? event, record = recordOf(node), registrations = eventRegistrations.get(node) ?? new Map;
1207
- eventRegistrations.set(node, registrations);
1322
+ };
1323
+ if (componentEventOnly(node, event))
1324
+ return unsubscribe;
1325
+ const nativeEvent = nativeEventName(event), record = recordOf(node);
1326
+ let registrations = eventRegistrations.get(node);
1327
+ if (!registrations)
1328
+ eventRegistrations.set(node, registrations = new Map);
1208
1329
  const existing = registrations.get(nativeEvent);
1209
1330
  if (existing && handlers.has(existing))
1210
1331
  return unsubscribe;
@@ -1247,7 +1368,7 @@ export function createNativeHost(options) {
1247
1368
  Object.defineProperty(physical, "currentTarget", { configurable: !0, value: target });
1248
1369
  const group = componentListeners.get(target) ?? [];
1249
1370
  for (const current of [...group]) {
1250
- if ((NATIVE_EVENT_NAMES[current.event.toLowerCase()] ?? current.event) !== nativeEvent || current.capture !== capture)
1371
+ if (nativeEventName(current.event) !== nativeEvent || current.capture !== capture)
1251
1372
  continue;
1252
1373
  if (target !== node && (current.event === "blur" || current.event === "focus"))
1253
1374
  continue;
@@ -1290,7 +1411,7 @@ export function createNativeHost(options) {
1290
1411
  }
1291
1412
  const form = formOwner(node);
1292
1413
  if (form && nativeEvent === "onSubmitEditing" && !physical?.defaultPrevented && !record.props.multiline && hostProps(record).returnKeyType !== "next") {
1293
- const implicit = implicitSubmitListeners.get(node), authored = componentListeners.get(node)?.some((listener) => (NATIVE_EVENT_NAMES[listener.event.toLowerCase()] ?? listener.event) === "onSubmitEditing" && listener.handler !== implicit?.listener);
1414
+ const implicit = implicitSubmitListeners.get(node), authored = componentListeners.get(node)?.some((listener) => nativeEventName(listener.event) === "onSubmitEditing" && listener.handler !== implicit?.listener);
1294
1415
  if (implicit && !authored) {
1295
1416
  const submitter = collectDescendants(form).find((control) => {
1296
1417
  const candidate = descriptorOf(control);
@@ -1314,7 +1435,7 @@ export function createNativeHost(options) {
1314
1435
  record.events[nativeEvent] = id;
1315
1436
  if (record.materialized)
1316
1437
  emit({ op: "updateNode", id: node.__stxId, patch: { events: { [nativeEvent]: id } } });
1317
- if (nativeEvent === "onPress") {
1438
+ if (nativeEvent === "onPress" && record.children.length) {
1318
1439
  for (const child of collectDescendants(node))
1319
1440
  if (["Button", "Pressable"].includes(descriptorOf(child)?.type ?? ""))
1320
1441
  installControlListeners(child);
@@ -2,7 +2,7 @@ var {require}=import.meta;import { existsSync, mkdirSync, copyFileSync, chmodSyn
2
2
  import { join, dirname, basename, resolve } from "node:path";
3
3
  import { spawn } from "node:child_process";
4
4
  import { platform as osPlatform } from "node:os";
5
- import { resolveCraftExecutablePath } from "@stacksjs/desktop";
5
+ import { createDiskImage, resolveCraftExecutablePath } from "@stacksjs/desktop";
6
6
  import { injectCraftBridge } from "./craft-bridge.js";
7
7
  import { processCraftComponents, CRAFT_COMPONENT_STYLES } from "./craft-components.js";
8
8
  import { renderTemplate } from "./render.js";
@@ -432,28 +432,7 @@ function getDefaultFormat(target) {
432
432
  }
433
433
  }
434
434
  async function createDMG(appBundlePath, outputPath, volumeName) {
435
- return new Promise((resolve) => {
436
- const proc = spawn("hdiutil", [
437
- "create",
438
- "-volname",
439
- volumeName,
440
- "-srcfolder",
441
- appBundlePath,
442
- "-ov",
443
- "-format",
444
- "UDZO",
445
- outputPath
446
- ]);
447
- proc.on("close", (code) => {
448
- if (code === 0)
449
- resolve({ success: !0 });
450
- else
451
- resolve({ success: !1, error: `hdiutil exited with code ${code}` });
452
- });
453
- proc.on("error", (err) => {
454
- resolve({ success: !1, error: err.message });
455
- });
456
- });
435
+ return createDiskImage({ appBundlePath, outputPath, volumeName });
457
436
  }
458
437
  async function createZip(sourceDir, outputPath) {
459
438
  return new Promise((resolve) => {
package/dist/pwa.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{Qs,Ht,xl,kg}from"./chunk-d50vw81s.js";import{Zs,Pi,vg,xg,Sg}from"./chunk-vpzdqbw7.js";import{bl,wl,vl,bg,wg}from"./chunk-3em44jbm.js";import{Ue,Tn,Ii}from"./chunk-7xs45trj.js";import{_g,Cg,Eg,Tg,eo,uy}from"./chunk-4s0ye933.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
3
- Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-etegf4zj.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
2
+ import{eo,Ht,Sl,_g}from"./chunk-jt0yn7ab.js";import{Qs,Ii,xg,Sg,kg}from"./chunk-6m4y5dh5.js";import{wl,vl,xl,wg,vg}from"./chunk-91htcq62.js";import{Ue,Tn,Oi}from"./chunk-y9bj3566.js";import{Cg,Eg,Tg,$g,to,dy}from"./chunk-20yz8bjp.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
3
+ Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-k8gpvg0w.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
4
4
  <html lang="en">
5
5
  <head>
6
6
  <meta charset="UTF-8">
@@ -233,4 +233,4 @@ Icon generation requires the sharp package for image processing.`),e.success=!1,
233
233
  }, 5000);
234
234
  </script>
235
235
  </body>
236
- </html>`}function b(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=Ue(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=Qs(n,t);if(a){let s=Ht(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return Pi(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,wl as auditBuildOutput,bl as auditConfig,re as buildPwaAssets,vl as calculateAuditResult,wg as formatAuditResult,Ii as formatSize,j as generateManifest,_ as generateManifestJson,xg as generateManifestLink,F as generateOfflinePage,Ue as generatePrecacheManifest,Tn as generatePrecacheManifestJs,M as generatePwaIcons,Zs as generatePwaTags,Qs as generateServiceWorker,kg as generateServiceWorkerAuto,vg as generateSwRegistrationScript,Sg as generateThemeColorMeta,N as getExpectedIconPaths,Ht as getServiceWorkerFileName,Pi as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,xl as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,eo as pwaDirectives,_g as pwaInstallDirective,Eg as pwaOfflineDirective,Tg as pwaPushDirective,Cg as pwaUpdateDirective,uy as registerPwaDirectives,bg as runPwaAudit,D as validateManifest};
236
+ </html>`}function b(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=Ue(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=eo(n,t);if(a){let s=Ht(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return Ii(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,vl as auditBuildOutput,wl as auditConfig,re as buildPwaAssets,xl as calculateAuditResult,vg as formatAuditResult,Oi as formatSize,j as generateManifest,_ as generateManifestJson,Sg as generateManifestLink,F as generateOfflinePage,Ue as generatePrecacheManifest,Tn as generatePrecacheManifestJs,M as generatePwaIcons,Qs as generatePwaTags,eo as generateServiceWorker,_g as generateServiceWorkerAuto,xg as generateSwRegistrationScript,kg as generateThemeColorMeta,N as getExpectedIconPaths,Ht as getServiceWorkerFileName,Ii as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,Sl as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,to as pwaDirectives,Cg as pwaInstallDirective,Tg as pwaOfflineDirective,$g as pwaPushDirective,Eg as pwaUpdateDirective,dy as registerPwaDirectives,wg as runPwaAudit,D as validateManifest};
package/dist/ssg.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import"./chunk-7sh9fa3q.js";import{w,nl}from"./chunk-624xpap6.js";import"./chunk-b58n1kfe.js";import"./chunk-2yxva96k.js";import{Rt,S}from"./chunk-zmr0pvcd.js";import"./chunk-qnxctfdf.js";import"./chunk-hnbx1t3t.js";import"./chunk-bzhzp4f4.js";import{kt,_t,Ct,Et,Tt,$t}from"./chunk-6wpwpk3c.js";import{a}from"./chunk-g4n0bjfb.js";import{Es}from"./chunk-tmfrq4nq.js";import"./chunk-53v4cby3.js";import"./chunk-y64f5t74.js";import{he,en,tn}from"./chunk-88acqv2r.js";import"./chunk-538d185r.js";import{y}from"./chunk-9jcqbgq9.js";import{yt,i}from"./chunk-hp10khyy.js";import"./chunk-njk5db1q.js";import"./chunk-3f8w1x6w.js";import{ps}from"./chunk-pnddmgjf.js";import"./chunk-2bvaakcv.js";import"./chunk-12jjf2me.js";import{Ya,Za,Qa}from"./chunk-hwcfgs3e.js";import{Zt,Yn,Zn}from"./chunk-ndjmt3vg.js";import{Qt}from"./chunk-y2jqx5k4.js";import"./chunk-7ckdvsmj.js";import"./chunk-azqf0ps0.js";import{X,we}from"./chunk-pm8a4kdf.js";import"./chunk-f4j7nsj1.js";import"./chunk-aksrh8je.js";import{l}from"./chunk-1hq3y7ss.js";import{r,ge}from"./chunk-3vpgr6nk.js";import D from"fs";import f from"path";import{createHash as vt}from"crypto";function Pt(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 It(t){return Bun.hash(t).toString(16)}function ot(t,n={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,o=t.replace(Dt,(e,u,g,v)=>{let x=v.trim();if(!x)return e;if(/\bdata-stx-src=/.test(g))return e;if(n.minify)x=Pt(x);let p=It(x);if(!s.has(p))s.set(p,x);let P=n.integrity?` data-stx-integrity="sha384-${vt("sha384").update(x).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${P}${g}></script>`}),c=Array.from(s,([e,u])=>({hash:e,code:u}));return{html:o,chunks:c}}var Bt=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let n=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=s.exec(t))!==null)n.set(o[1],o[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(Bt.has(n.get(u[1])||""))c.add(u[2]);let g=/<\/head\s*>/iy,v=S(t,(p,P)=>(g.lastIndex=P,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(c.size===0||v===-1)return t;let x=Array.from(c).filter((p)=>!t.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" as="script">`).join("");if(!x)return t;return t.slice(0,v)+x+t.slice(v)}var jt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function K(t){let n=t.trim();if(!n)return null;let s=/^https?:\/\//i.test(n)?n:`https://${n}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function Ft(t){for(let n of jt){let s=t[n];if(!s)continue;let o=K(s);if(o)return{url:o,source:"env",via:n}}return null}function lt(t){if(!t||typeof t!=="object")return null;let n=t,s=n.site?.url??n.url??n.app?.url;return typeof s==="string"?K(s):null}async function At(t){let{existsSync:n}=await import("fs"),s=await import("path");for(let o of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=s.resolve(t,o);if(!n(c))continue;try{let e=await import(c),u=lt(e.default??e);if(u)return u}catch{}}return null}async function ut(t={}){let n=t.cwd??process.cwd(),s=t.env??process.env;if(t.explicit){let u=K(t.explicit);if(u)return{url:u,source:"option"}}let o=lt(t.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let c=await At(n);if(c)return{url:c,source:"site.config",via:"url"};let e=Ft(s);if(e)return e;return{url:"http://localhost",source:"fallback"}}function dt(){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
- `)}function q(t){return async()=>({paths:await t(),fallback:!1})}var Ot;function Lt(t){let n=r(t),{depths:s}=ge(n),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,c;while((c=o.exec(n))!==null){if(s[c.index]!==0)continue;let u=w(n,"(",")",o.lastIndex-1),g=n.indexOf("{",u+1),v=w(n,"{","}",g);if(u<0||g<0||v<0)break;return t.slice(c.index,v+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((c=e.exec(n))!==null){if(s[c.index]!==0)continue;let u=nl(n,e.lastIndex).endPos;return t.slice(e.lastIndex,u).trim()}throw SyntaxError("Could not extract getStaticPaths; use a top-level function or const declaration")}async function gt(t){let n="read";try{let s=await Bun.file(t).text();n="parse";let o=Qt(s),c=[...o.server,...o.client,...o.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(r(e.attrs))).sort((e,u)=>s.indexOf(e.fullTag)-s.indexOf(u.fullTag));for(let e of c){if(!/\bgetStaticPaths\b/.test(r(e.content)))continue;let u=(Ot??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(r(u)))continue;let g=Lt(u);if(/\bdefineStaticPaths\b/.test(r(g))&&Rt(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");n="execute";let v=Function("defineStaticPaths",`return (${g})`)(q);if(typeof v!=="function")throw TypeError("getStaticPaths must be a function");let x=await v();n="result";let p=Array.isArray(x)?{paths:x}:x;if(!p||typeof p!=="object"||!("paths"in p)||!Array.isArray(p.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let P of p.paths)if(!P||typeof P!=="object"||!P.params||typeof P.params!=="object"||Array.isArray(P.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:p}}return{kind:"absent"}}catch(s){return{kind:"error",phase:n,error:s instanceof Error?s:Error(String(s))}}}class pt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,n=""){this.cacheDir=t,this.salt=n}async load(){if(this.loaded)return;let t=f.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let n=JSON.parse(await Bun.file(t).text());for(let[s,o]of Object.entries(n))this.cache.set(s,o)}catch{}this.loaded=!0}async save(){await D.promises.mkdir(this.cacheDir,{recursive:!0});let t=f.join(this.cacheDir,"build-cache.json"),n={};for(let[s,o]of this.cache)n[s]=o;await Bun.write(t,JSON.stringify(n))}getHash(t,n){let s=D.statSync(t),o=`${this.salt}|${t}:${s.mtimeMs}`;for(let e of n)if(D.existsSync(e)){let u=D.statSync(e);o+=`:${e}:${u.mtimeMs}`}let c=0;for(let e=0;e<o.length;e++){let u=o.charCodeAt(e);c=(c<<5)-c+u,c=c&c}return Math.abs(c).toString(36)}get(t,n){let s=this.cache.get(t);if(!s)return null;let o=ft(n).some((u)=>D.existsSync(u)),c=[n,...s.dependencies??[]].some((u)=>u.endsWith(".stx")&&D.existsSync(u)&&ps(D.readFileSync(u,"utf8")).some((g)=>/\bserver\b/.test(g.attrs)));if(o||c)return this.cache.delete(t),null;let e=this.getHash(n,s.dependencies??[]);if(s.hash!==e)return this.cache.delete(t),null;return s.html}set(t,n,s,o){let c=this.getHash(n,s);this.cache.set(t,{hash:c,html:o,generatedAt:Date.now(),dependencies:s})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let n=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return f.join(this.cacheDir,"isr",n)}async get(t){let n=this.getFilePath(t);if(!await Bun.file(n).exists())return null;try{return JSON.parse(await Bun.file(n).text())}catch{return null}}async set(t,n){let s=this.getFilePath(t);await D.promises.mkdir(f.dirname(s),{recursive:!0}),await Bun.write(s,JSON.stringify(n))}async invalidate(t){let n=this.getFilePath(t);if(await Bun.file(n).exists())await D.promises.unlink(n)}async invalidatePattern(t){let n=f.join(this.cacheDir,"isr");if(!D.existsSync(n))return;let s=await D.promises.readdir(n);for(let o of s){let c=o.replace(/_/g,"/").replace(".json","");if(t.test(c))await D.promises.unlink(f.join(n,o))}}async needsRevalidation(t){let n=await this.get(t);if(!n)return!0;return Date.now()>n.revalidateAfter}}async function Ut(t){let n=[];if(!t.isDynamic)n.push({url:t.pattern,params:{}});else{let s=await gt(t.filePath);if(s.kind==="error")throw Error(`getStaticPaths ${s.phase} failed for ${t.pattern} (${t.filePath}): ${s.error.message}`,{cause:s.error});if(s.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),n;let o=s.value;if(o.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),n;for(let c of o.paths){let e=t.pattern;for(let[u,g]of Object.entries(c.params))e=e.replace(`:${u}`,g).replace(`:${u}*`,g);n.push({url:e,params:c.params,props:c.props,revalidate:c.revalidate})}}return n}function ft(t){return[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"]}async function Mt(t){for(let n of ft(t))if(await Bun.file(n).exists())try{let s=await import(n);if(typeof s.default==="function")return await s.default();else if(typeof s.default==="object")return s.default;else if(typeof s.getData==="function")return await s.getData();else{let{default:o,...c}=s;return c}}catch(s){console.error(`Error loading data file ${n}:`,s)}return null}async function Gt(t,n,s){let o=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let c=o[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",`
2
+ import"./chunk-7sh9fa3q.js";import{w,rl}from"./chunk-4v50nafp.js";import"./chunk-t65tn8ee.js";import"./chunk-2yxva96k.js";import{Rt,S}from"./chunk-wp6bdac7.js";import"./chunk-akcyaxwv.js";import"./chunk-zbv8e4rq.js";import"./chunk-2ws2qe1k.js";import{kt,_t,Ct,Et,Tt,$t}from"./chunk-qjbpa1n4.js";import{a}from"./chunk-9x62j5f0.js";import{Ts}from"./chunk-7bxnjr3b.js";import"./chunk-qpvwxppw.js";import"./chunk-0beyn8ak.js";import{he,en,tn}from"./chunk-3x598qjt.js";import"./chunk-rbv6fxtx.js";import{y}from"./chunk-nw0v655w.js";import{yt,i}from"./chunk-e37g6ezw.js";import"./chunk-89jn2jmf.js";import"./chunk-q7q9e0gj.js";import{gs}from"./chunk-9k6tza24.js";import"./chunk-2z2bq2at.js";import"./chunk-c84pxd2k.js";import{Za,Qa,ec}from"./chunk-gjf8cjdt.js";import{Zt,Yn,Zn}from"./chunk-ndjmt3vg.js";import{Qt}from"./chunk-qm2wmqre.js";import"./chunk-rwys552r.js";import"./chunk-yv4dwdhc.js";import{K,we}from"./chunk-eegb7f3t.js";import"./chunk-aw6369cx.js";import"./chunk-3mby4nes.js";import{l}from"./chunk-kj8dvzpc.js";import{r,ge}from"./chunk-b9d70mgr.js";import D from"fs";import f from"path";import{createHash as vt}from"crypto";function Pt(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 It(t){return Bun.hash(t).toString(16)}function ot(t,n={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,o=t.replace(Dt,(e,u,g,v)=>{let x=v.trim();if(!x)return e;if(/\bdata-stx-src=/.test(g))return e;if(n.minify)x=Pt(x);let p=It(x);if(!s.has(p))s.set(p,x);let P=n.integrity?` data-stx-integrity="sha384-${vt("sha384").update(x).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${P}${g}></script>`}),c=Array.from(s,([e,u])=>({hash:e,code:u}));return{html:o,chunks:c}}var Bt=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let n=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=s.exec(t))!==null)n.set(o[1],o[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(Bt.has(n.get(u[1])||""))c.add(u[2]);let g=/<\/head\s*>/iy,v=S(t,(p,P)=>(g.lastIndex=P,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(c.size===0||v===-1)return t;let x=Array.from(c).filter((p)=>!t.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" as="script">`).join("");if(!x)return t;return t.slice(0,v)+x+t.slice(v)}var jt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function X(t){let n=t.trim();if(!n)return null;let s=/^https?:\/\//i.test(n)?n:`https://${n}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function Ft(t){for(let n of jt){let s=t[n];if(!s)continue;let o=X(s);if(o)return{url:o,source:"env",via:n}}return null}function lt(t){if(!t||typeof t!=="object")return null;let n=t,s=n.site?.url??n.url??n.app?.url;return typeof s==="string"?X(s):null}async function At(t){let{existsSync:n}=await import("fs"),s=await import("path");for(let o of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=s.resolve(t,o);if(!n(c))continue;try{let e=await import(c),u=lt(e.default??e);if(u)return u}catch{}}return null}async function ut(t={}){let n=t.cwd??process.cwd(),s=t.env??process.env;if(t.explicit){let u=X(t.explicit);if(u)return{url:u,source:"option"}}let o=lt(t.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let c=await At(n);if(c)return{url:c,source:"site.config",via:"url"};let e=Ft(s);if(e)return e;return{url:"http://localhost",source:"fallback"}}function dt(){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
+ `)}function q(t){return async()=>({paths:await t(),fallback:!1})}var Ot;function Lt(t){let n=r(t),{depths:s}=ge(n),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,c;while((c=o.exec(n))!==null){if(s[c.index]!==0)continue;let u=w(n,"(",")",o.lastIndex-1),g=n.indexOf("{",u+1),v=w(n,"{","}",g);if(u<0||g<0||v<0)break;return t.slice(c.index,v+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((c=e.exec(n))!==null){if(s[c.index]!==0)continue;let u=rl(n,e.lastIndex).endPos;return t.slice(e.lastIndex,u).trim()}throw SyntaxError("Could not extract getStaticPaths; use a top-level function or const declaration")}async function gt(t){let n="read";try{let s=await Bun.file(t).text();n="parse";let o=Qt(s),c=[...o.server,...o.client,...o.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(r(e.attrs))).sort((e,u)=>s.indexOf(e.fullTag)-s.indexOf(u.fullTag));for(let e of c){if(!/\bgetStaticPaths\b/.test(r(e.content)))continue;let u=(Ot??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(r(u)))continue;let g=Lt(u);if(/\bdefineStaticPaths\b/.test(r(g))&&Rt(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");n="execute";let v=Function("defineStaticPaths",`return (${g})`)(q);if(typeof v!=="function")throw TypeError("getStaticPaths must be a function");let x=await v();n="result";let p=Array.isArray(x)?{paths:x}:x;if(!p||typeof p!=="object"||!("paths"in p)||!Array.isArray(p.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let P of p.paths)if(!P||typeof P!=="object"||!P.params||typeof P.params!=="object"||Array.isArray(P.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:p}}return{kind:"absent"}}catch(s){return{kind:"error",phase:n,error:s instanceof Error?s:Error(String(s))}}}class pt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,n=""){this.cacheDir=t,this.salt=n}async load(){if(this.loaded)return;let t=f.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let n=JSON.parse(await Bun.file(t).text());for(let[s,o]of Object.entries(n))this.cache.set(s,o)}catch{}this.loaded=!0}async save(){await D.promises.mkdir(this.cacheDir,{recursive:!0});let t=f.join(this.cacheDir,"build-cache.json"),n={};for(let[s,o]of this.cache)n[s]=o;await Bun.write(t,JSON.stringify(n))}getHash(t,n){let s=D.statSync(t),o=`${this.salt}|${t}:${s.mtimeMs}`;for(let e of n)if(D.existsSync(e)){let u=D.statSync(e);o+=`:${e}:${u.mtimeMs}`}let c=0;for(let e=0;e<o.length;e++){let u=o.charCodeAt(e);c=(c<<5)-c+u,c=c&c}return Math.abs(c).toString(36)}get(t,n){let s=this.cache.get(t);if(!s)return null;let o=ft(n).some((u)=>D.existsSync(u)),c=[n,...s.dependencies??[]].some((u)=>u.endsWith(".stx")&&D.existsSync(u)&&gs(D.readFileSync(u,"utf8")).some((g)=>/\bserver\b/.test(g.attrs)));if(o||c)return this.cache.delete(t),null;let e=this.getHash(n,s.dependencies??[]);if(s.hash!==e)return this.cache.delete(t),null;return s.html}set(t,n,s,o){let c=this.getHash(n,s);this.cache.set(t,{hash:c,html:o,generatedAt:Date.now(),dependencies:s})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let n=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return f.join(this.cacheDir,"isr",n)}async get(t){let n=this.getFilePath(t);if(!await Bun.file(n).exists())return null;try{return JSON.parse(await Bun.file(n).text())}catch{return null}}async set(t,n){let s=this.getFilePath(t);await D.promises.mkdir(f.dirname(s),{recursive:!0}),await Bun.write(s,JSON.stringify(n))}async invalidate(t){let n=this.getFilePath(t);if(await Bun.file(n).exists())await D.promises.unlink(n)}async invalidatePattern(t){let n=f.join(this.cacheDir,"isr");if(!D.existsSync(n))return;let s=await D.promises.readdir(n);for(let o of s){let c=o.replace(/_/g,"/").replace(".json","");if(t.test(c))await D.promises.unlink(f.join(n,o))}}async needsRevalidation(t){let n=await this.get(t);if(!n)return!0;return Date.now()>n.revalidateAfter}}async function Ut(t){let n=[];if(!t.isDynamic)n.push({url:t.pattern,params:{}});else{let s=await gt(t.filePath);if(s.kind==="error")throw Error(`getStaticPaths ${s.phase} failed for ${t.pattern} (${t.filePath}): ${s.error.message}`,{cause:s.error});if(s.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),n;let o=s.value;if(o.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),n;for(let c of o.paths){let e=t.pattern;for(let[u,g]of Object.entries(c.params))e=e.replace(`:${u}`,g).replace(`:${u}*`,g);n.push({url:e,params:c.params,props:c.props,revalidate:c.revalidate})}}return n}function ft(t){return[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"]}async function Mt(t){for(let n of ft(t))if(await Bun.file(n).exists())try{let s=await import(n);if(typeof s.default==="function")return await s.default();else if(typeof s.default==="object")return s.default;else if(typeof s.getData==="function")return await s.getData();else{let{default:o,...c}=s;return c}}catch(s){console.error(`Error loading data file ${n}:`,s)}return null}async function Gt(t,n,s){let o=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let c=o[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",`
4
4
  return (async function getStaticProps() {
5
5
  ${e[1]}
6
6
  })()
@@ -37,7 +37,7 @@ ${t.map((o)=>{let c=new URL(o.loc,n).href,e=` <url>
37
37
  ${s.join(`
38
38
  `)}
39
39
  </channel>
40
- </rss>`}async function Vt(t={}){let n=Date.now();tn();let s=await a(process.cwd()),o=s.build||{},c=await ut({explicit:t.domain||o.domain,stxConfig:s});if(c.source==="fallback"&&(t.sitemap??o.sitemap??!0))console.warn(dt());let e={router:t.router??s?.router??{},pagesDir:t.pagesDir||o.pagesDir||"pages",outputDir:t.outputDir||o.outputDir||"dist",baseUrl:t.baseUrl||o.baseUrl||"/",domain:c.url,revalidate:t.revalidate??o.revalidate??!1,sitemap:t.sitemap??o.sitemap??!0,sitemapExclude:t.sitemapExclude||o.sitemapExclude||[],robots:t.robots??o.robots??!0,rss:t.rss??o.rss??!1,concurrency:t.concurrency||o.concurrency||10,cache:t.cache??o.cache??!0,cacheDir:t.cacheDir||o.cacheDir||l(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??o.minify??!0,generate404:t.generate404??o.generate404??!0,publicDir:t.publicDir||o.publicDir||"public",trailingSlash:t.trailingSlash??o.trailingSlash??!1,cleanOutput:t.cleanOutput??o.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||s?.partialsDir||"",componentsDir:t.componentsDir||s?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},g=new Set,v=0,x={},p={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&D.existsSync(e.outputDir))await D.promises.rm(e.outputDir,{recursive:!0});await D.promises.mkdir(e.outputDir,{recursive:!0});let E=e.cacheSalt;if(!E){let{resolveUserCssConfig:d,fingerprintConfig:m}=await import("./chunk-cfr7cd88.js");try{E=m(await d(process.cwd()))}catch{}}let{prepareImageDelivery:b}=await import("./chunk-tes8fdv6.js"),R=await b(e.publicDir,e.outputDir);if(R.count>0)console.log(`Optimized ${R.count} image(s) for responsive delivery`),E=[E,R.fingerprint].filter(Boolean).join(":");let T=new pt(e.cacheDir,E);if(e.cache)await T.load();try{let{generateCss:d}=await import("./chunk-cfr7cd88.js");await d('<div class="bg-black"></div>')}catch{}kt();let wt=s?.routeMiddleware?.dir||"middleware";await Ct(process.cwd(),wt);let J=_t();if(J.length>0)console.log(`Loaded ${J.length} middleware: ${J.join(", ")}`);let St=s?.routeMiddleware?.global||[];Qa(s?.layoutsDir,l(process.cwd()));let Z=X(".",{pagesDir:e.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${Z.length} routes`);let M=[];for(let d of Z)try{let m=await Ut(d);for(let k of m)M.push({route:d,url:k.url,params:k.params,props:k.props,revalidate:k.revalidate??e.revalidate})}catch(m){let k=m instanceof Error?m:Error(String(m));u.failedCount++,u.errors.push({route:d.pattern,error:k}),await e.hooks.onError?.(k,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,k)}u.totalPages=M.length+u.failedCount,console.log(`Generating ${M.length} pages...`);let _=[],Q=[];for(let d=0;d<M.length;d+=e.concurrency)Q.push(M.slice(d,d+e.concurrency));for(let d of Q)await Promise.all(d.map(async(m)=>{let{route:k,url:h,params:G,props:xt,revalidate:rt}=m;try{await e.hooks.onPageStart?.(h);let A=await Bun.file(k.filePath).text(),O=Yt(A),bt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],nt=[...St,...bt];if(nt.length>0){let B=Et(h,G,O||{}),L=Tt(B,null,void 0,{isServer:!0}),j=await $t(nt,L);if(j.redirect){let C=typeof j.redirect==="string"?j.redirect:j.redirect.path||j.redirect,H=te(String(C),h),U=ee(h,e);await D.promises.mkdir(f.dirname(U),{recursive:!0}),await Bun.write(U,H),u.successCount++,u.pages.push({route:h,outputPath:U,size:Buffer.byteLength(H),cached:!1}),_.push({loc:h,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${h} \u2192 redirect to ${C}`);return}if(j.abort){let C=typeof j.abort==="string"?j.abort:j.abort?.error?.message||"aborted";console.warn(` \u21B3 ${h} \u2014 middleware aborted: ${C}`);return}}let it=A.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(it)try{if(!await Function("route",`
40
+ </rss>`}async function Vt(t={}){let n=Date.now();tn();let s=await a(process.cwd()),o=s.build||{},c=await ut({explicit:t.domain||o.domain,stxConfig:s});if(c.source==="fallback"&&(t.sitemap??o.sitemap??!0))console.warn(dt());let e={router:t.router??s?.router??{},pagesDir:t.pagesDir||o.pagesDir||"pages",outputDir:t.outputDir||o.outputDir||"dist",baseUrl:t.baseUrl||o.baseUrl||"/",domain:c.url,revalidate:t.revalidate??o.revalidate??!1,sitemap:t.sitemap??o.sitemap??!0,sitemapExclude:t.sitemapExclude||o.sitemapExclude||[],robots:t.robots??o.robots??!0,rss:t.rss??o.rss??!1,concurrency:t.concurrency||o.concurrency||10,cache:t.cache??o.cache??!0,cacheDir:t.cacheDir||o.cacheDir||l(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??o.minify??!0,generate404:t.generate404??o.generate404??!0,publicDir:t.publicDir||o.publicDir||"public",trailingSlash:t.trailingSlash??o.trailingSlash??!1,cleanOutput:t.cleanOutput??o.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||s?.partialsDir||"",componentsDir:t.componentsDir||s?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},g=new Set,v=0,x={},p={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&D.existsSync(e.outputDir))await D.promises.rm(e.outputDir,{recursive:!0});await D.promises.mkdir(e.outputDir,{recursive:!0});let E=e.cacheSalt;if(!E){let{resolveUserCssConfig:d,fingerprintConfig:m}=await import("./chunk-4hgz9dkv.js");try{E=m(await d(process.cwd()))}catch{}}let{prepareImageDelivery:b}=await import("./chunk-s0bx4gjh.js"),R=await b(e.publicDir,e.outputDir);if(R.count>0)console.log(`Optimized ${R.count} image(s) for responsive delivery`),E=[E,R.fingerprint].filter(Boolean).join(":");let T=new pt(e.cacheDir,E);if(e.cache)await T.load();try{let{generateCss:d}=await import("./chunk-4hgz9dkv.js");await d('<div class="bg-black"></div>')}catch{}kt();let wt=s?.routeMiddleware?.dir||"middleware";await Ct(process.cwd(),wt);let J=_t();if(J.length>0)console.log(`Loaded ${J.length} middleware: ${J.join(", ")}`);let St=s?.routeMiddleware?.global||[];ec(s?.layoutsDir,l(process.cwd()));let Z=K(".",{pagesDir:e.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${Z.length} routes`);let M=[];for(let d of Z)try{let m=await Ut(d);for(let k of m)M.push({route:d,url:k.url,params:k.params,props:k.props,revalidate:k.revalidate??e.revalidate})}catch(m){let k=m instanceof Error?m:Error(String(m));u.failedCount++,u.errors.push({route:d.pattern,error:k}),await e.hooks.onError?.(k,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,k)}u.totalPages=M.length+u.failedCount,console.log(`Generating ${M.length} pages...`);let _=[],Q=[];for(let d=0;d<M.length;d+=e.concurrency)Q.push(M.slice(d,d+e.concurrency));for(let d of Q)await Promise.all(d.map(async(m)=>{let{route:k,url:h,params:G,props:xt,revalidate:rt}=m;try{await e.hooks.onPageStart?.(h);let A=await Bun.file(k.filePath).text(),O=Yt(A),bt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],nt=[...St,...bt];if(nt.length>0){let B=Et(h,G,O||{}),L=Tt(B,null,void 0,{isServer:!0}),j=await $t(nt,L);if(j.redirect){let C=typeof j.redirect==="string"?j.redirect:j.redirect.path||j.redirect,H=te(String(C),h),U=ee(h,e);await D.promises.mkdir(f.dirname(U),{recursive:!0}),await Bun.write(U,H),u.successCount++,u.pages.push({route:h,outputPath:U,size:Buffer.byteLength(H),cached:!1}),_.push({loc:h,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${h} \u2192 redirect to ${C}`);return}if(j.abort){let C=typeof j.abort==="string"?j.abort:j.abort?.error?.message||"aborted";console.warn(` \u21B3 ${h} \u2014 middleware aborted: ${C}`);return}}let it=A.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(it)try{if(!await Function("route",`
41
41
  const validate = ${it[1]};
42
42
  return validate(route);
43
43
  `)({params:G})){console.warn(`Validation failed for ${h}, skipping...`);return}}catch{}let I=null,st=!1;if(e.cache){if(I=T.get(h,k.filePath),I)st=!0,u.cachedCount++}if(!I){let B=await mt(k,G,xt,e,s);if(I=B.html,e.failOnIncludeError&&B.includeFailures.length>0)throw Error(`${B.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
@@ -69,7 +69,7 @@ ${d}`)}if(e.cache)await T.save();if(e.generate404){let d=f.join(e.pagesDir,"404.
69
69
  <a href="/">Go home</a>
70
70
  </div>
71
71
  </body>
72
- </html>`)}for(let d of[500]){let m=f.join(e.pagesDir,`${d}.stx`);if(await Bun.file(m).exists()){let k=new Set,h={...s,minifyClient:!0,debug:!1,cache:!1},G=await i(await Bun.file(m).text(),{},m,h,k);await Bun.write(f.join(e.outputDir,`${d}.html`),G)}}let V=f.join(e.pagesDir,"error.stx");if(await Bun.file(V).exists()){let d=new Set,m={...s,minifyClient:!0,debug:!1,cache:!1},k=await i(await Bun.file(V).text(),{},V,m,d);await Bun.write(f.join(e.outputDir,"error.html"),k)}if(e.sitemap&&_.length>0){let d=qt(_,e.domain),m=f.join(e.outputDir,"sitemap.xml");await Bun.write(m,d),u.sitemapPath=m,console.log(`Generated sitemap.xml with ${_.length} URLs`)}if(e.robots!==!1){let d=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((h)=>typeof h==="string"),...d.disallow||[]],k=Es({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...m.length>0?{disallow:m}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(f.join(e.outputDir,"robots.txt"),k),console.log("Generated robots.txt")}if(e.rss){let d=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(d.getItems)m=await d.getItems();let k=Jt(d,m),h=f.join(e.outputDir,"rss.xml");await Bun.write(h,k),u.rssPath=h,console.log(`Generated rss.xml with ${m.length} items`)}let z=Ya(e.outputDir);if(z.assets>0)console.log(`Externalized ${z.assets} asset(s) from ${z.pages} page(s) (${(z.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let W=Za(e.outputDir);if(W.assets>0)console.log(`Externalized ${W.assets} repeated asset(s) from ${W.pages} page(s) (${(W.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&D.existsSync(e.publicDir))await Y(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let et=Zn();if(et)await Y(et,f.join(e.outputDir,Yn)),console.log(`Copied assets from ${Zt}`)}catch(E){throw await e.hooks.onError?.(E),E}if(u.buildTime=Date.now()-n,g.size>0){u.islandChunks={count:g.size,totalBytes:v};let E={generatedChunks:g.size,totalBytes:v,chunks:x,pages:p};await Bun.write(f.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(E,null,2))}await e.hooks.onBuildEnd?.(u);let P=u.islandChunks?`
72
+ </html>`)}for(let d of[500]){let m=f.join(e.pagesDir,`${d}.stx`);if(await Bun.file(m).exists()){let k=new Set,h={...s,minifyClient:!0,debug:!1,cache:!1},G=await i(await Bun.file(m).text(),{},m,h,k);await Bun.write(f.join(e.outputDir,`${d}.html`),G)}}let V=f.join(e.pagesDir,"error.stx");if(await Bun.file(V).exists()){let d=new Set,m={...s,minifyClient:!0,debug:!1,cache:!1},k=await i(await Bun.file(V).text(),{},V,m,d);await Bun.write(f.join(e.outputDir,"error.html"),k)}if(e.sitemap&&_.length>0){let d=qt(_,e.domain),m=f.join(e.outputDir,"sitemap.xml");await Bun.write(m,d),u.sitemapPath=m,console.log(`Generated sitemap.xml with ${_.length} URLs`)}if(e.robots!==!1){let d=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((h)=>typeof h==="string"),...d.disallow||[]],k=Ts({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...m.length>0?{disallow:m}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(f.join(e.outputDir,"robots.txt"),k),console.log("Generated robots.txt")}if(e.rss){let d=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(d.getItems)m=await d.getItems();let k=Jt(d,m),h=f.join(e.outputDir,"rss.xml");await Bun.write(h,k),u.rssPath=h,console.log(`Generated rss.xml with ${m.length} items`)}let z=Za(e.outputDir);if(z.assets>0)console.log(`Externalized ${z.assets} asset(s) from ${z.pages} page(s) (${(z.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let W=Qa(e.outputDir);if(W.assets>0)console.log(`Externalized ${W.assets} repeated asset(s) from ${W.pages} page(s) (${(W.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&D.existsSync(e.publicDir))await Y(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let et=Zn();if(et)await Y(et,f.join(e.outputDir,Yn)),console.log(`Copied assets from ${Zt}`)}catch(E){throw await e.hooks.onError?.(E),E}if(u.buildTime=Date.now()-n,g.size>0){u.islandChunks={count:g.size,totalBytes:v};let E={generatedChunks:g.size,totalBytes:v,chunks:x,pages:p};await Bun.write(f.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(E,null,2))}await e.hooks.onBuildEnd?.(u);let P=u.islandChunks?`
73
73
  Island chunks: ${u.islandChunks.count} (${(u.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
74
74
  Build complete!
75
75
  Total: ${u.totalPages} pages
@@ -77,7 +77,7 @@ Build complete!
77
77
  Cached: ${u.cachedCount}
78
78
  Failed: ${u.failedCount}
79
79
  Time: ${u.buildTime}ms${P}
80
- `),u}async function Y(t,n){await D.promises.mkdir(n,{recursive:!0});let s=await D.promises.readdir(t,{withFileTypes:!0});for(let o of s){let c=f.join(t,o.name),e=f.join(n,o.name);if(o.isDirectory())await D.promises.mkdir(e,{recursive:!0}),await Y(c,e);else await D.promises.copyFile(c,e)}}function Kt(t={}){let n=t.cacheDir||l(process.cwd(),"ssg-cache"),s=new ht(n),o=t.revalidate||3600;return{async get(c){let e=await s.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=${o}, stale-while-revalidate=${o*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(c){let u=X(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>c.match(P.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${c}`);return}let g=c.match(u.regex),v={};if(g)u.params.forEach((P,E)=>{v[P]=g[E+1]});let x=await a(),{html:p}=await mt(u,v,{},t,x);await s.set(c,{html:p,generatedAt:Date.now(),revalidateAfter:Date.now()+o*1000,etag:zt(p)}),console.log(`Revalidated: ${c}`)},async invalidate(c){if(typeof c==="string")await s.invalidate(c);else await s.invalidatePattern(c)}}}function Xt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let n=await Bun.file(t).text(),s=n.match(/^---\n([\s\S]*?)\n---/),o={},c=n;if(s){let x=s[1];c=n.slice(s[0].length).trim();for(let p of x.split(`
80
+ `),u}async function Y(t,n){await D.promises.mkdir(n,{recursive:!0});let s=await D.promises.readdir(t,{withFileTypes:!0});for(let o of s){let c=f.join(t,o.name),e=f.join(n,o.name);if(o.isDirectory())await D.promises.mkdir(e,{recursive:!0}),await Y(c,e);else await D.promises.copyFile(c,e)}}function Kt(t={}){let n=t.cacheDir||l(process.cwd(),"ssg-cache"),s=new ht(n),o=t.revalidate||3600;return{async get(c){let e=await s.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=${o}, stale-while-revalidate=${o*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(c){let u=K(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>c.match(P.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${c}`);return}let g=c.match(u.regex),v={};if(g)u.params.forEach((P,E)=>{v[P]=g[E+1]});let x=await a(),{html:p}=await mt(u,v,{},t,x);await s.set(c,{html:p,generatedAt:Date.now(),revalidateAfter:Date.now()+o*1000,etag:zt(p)}),console.log(`Revalidated: ${c}`)},async invalidate(c){if(typeof c==="string")await s.invalidate(c);else await s.invalidatePattern(c)}}}function Xt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let n=await Bun.file(t).text(),s=n.match(/^---\n([\s\S]*?)\n---/),o={},c=n;if(s){let x=s[1];c=n.slice(s[0].length).trim();for(let p of x.split(`
81
81
  `)){let P=p.indexOf(":");if(P>0){let E=p.slice(0,P).trim(),b=p.slice(P+1).trim();if(b==="true")b=!0;else if(b==="false")b=!1;else if(/^\d+$/.test(b))b=parseInt(b,10);else if(/^\d+\.\d+$/.test(b))b=parseFloat(b);else if(b.startsWith("[")&&b.endsWith("]"))b=b.slice(1,-1).split(",").map((R)=>R.trim().replace(/^['"]|['"]$/g,""));o[E]=b}}}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>"),u=[],g=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,v;while((v=g.exec(e))!==null){let x=parseInt(v[1],10),p=v[2],P=p.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:P,text:p,level:x})}return{content:e,data:o,toc:u}}}}function Yt(t){return yt(t)}function te(t,n){return`<!DOCTYPE html>
82
82
  <html>
83
83
  <head>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.795",
4
+ "version": "0.2.798",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -126,14 +126,14 @@
126
126
  "typecheck": "bun tsc -p tsconfig.src.json --noEmit"
127
127
  },
128
128
  "dependencies": {
129
- "@stacksjs/ts-css": "^0.3.11",
129
+ "@stacksjs/ts-css": "^0.3.21",
130
130
  "@stacksjs/clapp": "^0.2.16",
131
- "@stacksjs/desktop": "0.2.795",
132
- "@stacksjs/sanitizer": "0.2.795",
131
+ "@stacksjs/desktop": "0.2.798",
132
+ "@stacksjs/sanitizer": "0.2.798",
133
133
  "@stacksjs/ts-i18n": "^0.1.11",
134
- "bun-plugin-stx": "0.2.795",
134
+ "bun-plugin-stx": "0.2.798",
135
135
  "bunfig": "^0.15.21",
136
- "stx-router": "0.2.795",
136
+ "stx-router": "0.2.798",
137
137
  "ts-broadcasting": "^0.0.11",
138
138
  "ts-images": "^0.2.22",
139
139
  "ts-syntax-highlighter": "^0.2.1"
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Oi,Ni,Mi,$g,Rg,Ag,Sl,Pg,Ig}from"./chunk-jmbh26gv.js";export{Oi as ImageProcessorCache,Sl as applyTransformations,$g as clearImageCache,Pg as generateResponsiveVariants,Ig as generateSrcset,Ni as getCachedImageResult,Ag as optimizeImage,Rg as processImage,Mi as setCachedImageResult};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{wf,vf,he,xf,ec,en,tn,vh,tc,nn,Qn,Sf,kf,_f,ss,rn,Cf,sn,nc,xh}from"./chunk-88acqv2r.js";import"./chunk-y64f5t74.js";import"./chunk-7sh9fa3q.js";import"./chunk-g4n0bjfb.js";import"./chunk-aksrh8je.js";import"./chunk-bzhzp4f4.js";import"./chunk-53v4cby3.js";import"./chunk-tmfrq4nq.js";import"./chunk-6wpwpk3c.js";import"./chunk-zmr0pvcd.js";import"./chunk-hnbx1t3t.js";import"./chunk-qnxctfdf.js";import"./chunk-624xpap6.js";import"./chunk-2yxva96k.js";import"./chunk-b58n1kfe.js";export{Qn as MODULE_SPECIFIER_PREFIX,wf as bundleCacheDir,vf as bundleCacheEntryLimit,xh as bundleClientEntriesSplit,sn as bundleClientScript,tn as clearBundleFailures,he as clientBundleDependencies,en as getBundleFailures,nn as hasUserImports,rn as moduleSubstitutionKey,kf as normalizeRegistrySpecifiers,Cf as queueClientBundleBuild,ec as recordBundleFailure,Sf as registryIdForPath,tc as resolveBundlerFallback,_f as rewriteRegistryImports,vh as setBundlerFallbackMode,xf as shouldLogBundlerDiagnostics,nc as tempBuildName,ss as withModuleSubstitutes};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Vg}from"./chunk-mcj5qtpp.js";import"./chunk-hp10khyy.js";import"./chunk-9jcqbgq9.js";import"./chunk-3f8w1x6w.js";import"./chunk-12jjf2me.js";import"./chunk-njk5db1q.js";import"./chunk-7ckdvsmj.js";import"./chunk-2bvaakcv.js";import"./chunk-azqf0ps0.js";import"./chunk-pnddmgjf.js";import"./chunk-pm8a4kdf.js";import"./chunk-f4j7nsj1.js";import"./chunk-538d185r.js";import"./chunk-g4n0bjfb.js";import"./chunk-aksrh8je.js";import"./chunk-bzhzp4f4.js";import"./chunk-53v4cby3.js";import"./chunk-tmfrq4nq.js";import"./chunk-6wpwpk3c.js";import"./chunk-zmr0pvcd.js";import"./chunk-hnbx1t3t.js";import"./chunk-qnxctfdf.js";import"./chunk-624xpap6.js";import"./chunk-2yxva96k.js";import"./chunk-b58n1kfe.js";export{Vg as startInteractive};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{co,ea,Ur,lo,uo,Rn,Kt,ta,Wr,qr,po,fo,qg,Kg,pt}from"./chunk-1q16p7t2.js";export{pt as DeployError,ea as calculateSha1,Ur as collectDeployFiles,qr as createDefaultNetlifyConfig,lo as createFileManifest,co as createNetlifyClient,qg as deploy,Wr as detectProjectConfig,uo as filterRequiredFiles,Rn as formatSize,ta as generateNetlifyToml,Kt as getTotalSize,fo as hasNetlifyConfig,Kg as initNetlify,po as writeNetlifyConfig};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Yo,Zo,Qo,ei,_s,Cs,zh,Hh,Vh,Uh,Es,Wh}from"./chunk-tmfrq4nq.js";import"./chunk-624xpap6.js";export{Wh as generateDefaultRobotsTxt,Es as generateRobotsTxt,Hh as generateSitemap,Vh as generateSitemapIndex,ei as injectSeoTags,_s as metaDirective,Yo as processMetaDirectives,Qo as processSeoDirective,Zo as processStructuredData,zh as registerSeoDirectives,Uh as scanForSitemapEntries,Cs as structuredDataDirective};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ga,dm}from"./chunk-ka8sk5qa.js";export{ga as definePlugin,dm as pluginManager};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{zm}from"./chunk-p3ej3954.js";export{zm as processDeferDirectives};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Di,Li,ji,Og,Bi,Fi,Ng,zi,Hi,kl,Mg}from"./chunk-dstzvtvk.js";export{Di as VideoProcessorCache,kl as analyzeVideo,Og as clearVideoCache,Hi as generateDASHManifest,zi as generateHLSManifest,Bi as generatePoster,Ng as generateSpriteSheet,Fi as generateThumbnails,Li as getCachedVideoResult,Mg as processVideo,ji as setCachedVideoResult};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Qs,Ht,xl,kg}from"./chunk-d50vw81s.js";export{Qs as generateServiceWorker,kg as generateServiceWorkerAuto,Ht as getServiceWorkerFileName,xl as isWorkboxEnabled};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Bf,Go}from"./chunk-bzhzp4f4.js";export{Bf as looksLikeGlob,Go as resolveStxTargets};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Zs,Pi,vg,xg,Sg}from"./chunk-vpzdqbw7.js";import"./chunk-d50vw81s.js";export{xg as generateManifestLink,Zs as generatePwaTags,vg as generateSwRegistrationScript,Sg as generateThemeColorMeta,Pi as injectPwaTags};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{vn,vi}from"./chunk-hnbx1t3t.js";import"./chunk-qnxctfdf.js";export{vi as generateRuntimeConfigTypes,vn as prepareRuntimeConfig};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Qg}from"./chunk-x8ghjw9b.js";import"./chunk-ayd635jf.js";import"./chunk-axjfaere.js";import"./chunk-y2jqx5k4.js";import"./chunk-y64f5t74.js";import"./chunk-hp10khyy.js";import"./chunk-9jcqbgq9.js";import"./chunk-3f8w1x6w.js";import"./chunk-12jjf2me.js";import"./chunk-njk5db1q.js";import"./chunk-7ckdvsmj.js";import"./chunk-2bvaakcv.js";import"./chunk-azqf0ps0.js";import"./chunk-pnddmgjf.js";import"./chunk-pm8a4kdf.js";import"./chunk-f4j7nsj1.js";import"./chunk-538d185r.js";import"./chunk-g4n0bjfb.js";import"./chunk-aksrh8je.js";import"./chunk-bzhzp4f4.js";import"./chunk-53v4cby3.js";import"./chunk-tmfrq4nq.js";import"./chunk-6wpwpk3c.js";import"./chunk-zmr0pvcd.js";import"./chunk-hnbx1t3t.js";import"./chunk-qnxctfdf.js";import"./chunk-624xpap6.js";import"./chunk-2yxva96k.js";import"./chunk-b58n1kfe.js";export{Qg as buildForProduction};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{on,Ro,Ao,Po,Sh,Io}from"./chunk-y64f5t74.js";import"./chunk-53v4cby3.js";import"./chunk-6wpwpk3c.js";import"./chunk-qnxctfdf.js";export{Ao as buildServerApi,Sh as createServerApi,on as discoverServerApi,Ro as generateApiTypes,Io as isServerApiSource,Po as productionApiDispatcher};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{V}from"./chunk-zmr0pvcd.js";function n(t){return V(t)}
3
- export{n};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Jm,Ym,Zm,Qm,eh}from"./chunk-tqvw1673.js";export{Ym as createSSRSuspense,Qm as generateSuspenseCSS,eh as generateSuspenseRuntime,Jm as processSuspenseDirectives,Zm as renderSSRSuspense};