@stacksjs/stx 0.2.432 → 0.2.434

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 (145) hide show
  1. package/dist/{chunk-wy873fy8.js → chunk-0n28xm1q.js} +1 -1
  2. package/dist/{chunk-b7973zvk.js → chunk-114zdbnd.js} +2 -2
  3. package/dist/chunk-11h97cn9.js +2 -0
  4. package/dist/{chunk-w715g0wp.js → chunk-1j2z24r5.js} +5 -5
  5. package/dist/{chunk-2y936zb0.js → chunk-1njrhrmw.js} +11 -11
  6. package/dist/{chunk-w3j0ppg4.js → chunk-1yj3p63h.js} +2 -2
  7. package/dist/{chunk-aen2baze.js → chunk-3rbz496d.js} +1 -1
  8. package/dist/{chunk-cznsm2n3.js → chunk-489z8wry.js} +2 -2
  9. package/dist/chunk-4x884b3c.js +2 -0
  10. package/dist/chunk-4xqtfka6.js +2 -0
  11. package/dist/{chunk-zjet6r6p.js → chunk-5dh5cdmv.js} +1 -1
  12. package/dist/chunk-60j147cj.js +2 -0
  13. package/dist/chunk-60pc7151.js +2 -0
  14. package/dist/{chunk-mjgqhhap.js → chunk-721yq8qx.js} +3 -3
  15. package/dist/{chunk-0hhq9hbq.js → chunk-74j5jbs6.js} +3 -3
  16. package/dist/chunk-7envdam0.js +2 -0
  17. package/dist/chunk-7jw2zhb9.js +2 -0
  18. package/dist/{chunk-0bmc75w6.js → chunk-7x8qwshk.js} +2 -2
  19. package/dist/chunk-80q2becc.js +2 -0
  20. package/dist/chunk-88ey0pdm.js +2 -0
  21. package/dist/{chunk-be01xyb8.js → chunk-8bew5svs.js} +2 -2
  22. package/dist/chunk-8bpf8d7n.js +2 -0
  23. package/dist/{chunk-ktedzx9e.js → chunk-8wkja2z2.js} +2 -2
  24. package/dist/{chunk-3ry9ca1s.js → chunk-8x47zcfa.js} +2 -2
  25. package/dist/{chunk-rnbgn7xn.js → chunk-93e1nf1y.js} +1 -1
  26. package/dist/{chunk-dsxgv6g2.js → chunk-9jr7jbgv.js} +191 -191
  27. package/dist/{chunk-7a9h7ycs.js → chunk-9w5nse46.js} +3 -3
  28. package/dist/chunk-9xmdj73x.js +2 -0
  29. package/dist/{chunk-eej89wkt.js → chunk-9yy4fyq6.js} +1 -1
  30. package/dist/chunk-9zf2xmj5.js +2 -0
  31. package/dist/{chunk-knmj9ynm.js → chunk-a0v1fxzj.js} +1 -1
  32. package/dist/{chunk-vz86nx8y.js → chunk-a5qzw9te.js} +1 -1
  33. package/dist/{chunk-tpnfcb83.js → chunk-a88mq2k6.js} +1 -1
  34. package/dist/{chunk-stxmwytg.js → chunk-b8dbq51z.js} +2 -2
  35. package/dist/{chunk-5f0r0g18.js → chunk-b9wpgn7b.js} +3 -3
  36. package/dist/{chunk-4gs26aa4.js → chunk-basztgd4.js} +1 -1
  37. package/dist/chunk-begfdc6a.js +17 -0
  38. package/dist/{chunk-myfm3415.js → chunk-bqjty9dx.js} +1 -1
  39. package/dist/{chunk-c1dmr865.js → chunk-ccq35xp7.js} +3 -3
  40. package/dist/chunk-cnmz9543.js +2 -0
  41. package/dist/chunk-cv56m171.js +2 -0
  42. package/dist/{chunk-19mnptan.js → chunk-d2z6tmzw.js} +2 -2
  43. package/dist/{chunk-vz821mjg.js → chunk-d35y8thn.js} +1 -1
  44. package/dist/chunk-d7stgehg.js +2 -0
  45. package/dist/chunk-dpxj1gez.js +2 -0
  46. package/dist/{chunk-4hd5wb8x.js → chunk-dtvwes4f.js} +1 -1
  47. package/dist/{chunk-djdf6agj.js → chunk-ed7p2a5q.js} +1 -1
  48. package/dist/chunk-et2kt16p.js +2 -0
  49. package/dist/{chunk-tgq0vprh.js → chunk-f6cz5n4m.js} +1 -1
  50. package/dist/chunk-fg8kmyz8.js +2 -0
  51. package/dist/{chunk-pmpc9fd5.js → chunk-hb3epf4b.js} +1 -1
  52. package/dist/{chunk-ex0tq6x2.js → chunk-hc9242wm.js} +1 -1
  53. package/dist/chunk-j4kqw34b.js +2 -0
  54. package/dist/chunk-jtysg2ss.js +2 -0
  55. package/dist/chunk-k5tcanyq.js +2 -0
  56. package/dist/{chunk-dhqwg62x.js → chunk-k6kvgdd0.js} +1 -1
  57. package/dist/{chunk-03n23sh6.js → chunk-kcwz3kvn.js} +1 -1
  58. package/dist/{chunk-sbdzqqr1.js → chunk-m607bd3m.js} +1 -1
  59. package/dist/chunk-m73mswbe.js +2 -0
  60. package/dist/chunk-mq75bc92.js +2 -0
  61. package/dist/{chunk-fb7bfyjz.js → chunk-my3jkpv7.js} +3 -3
  62. package/dist/{chunk-2112wffa.js → chunk-nhg3r4ae.js} +4 -4
  63. package/dist/{chunk-wr9ac0cv.js → chunk-nvht5259.js} +2 -2
  64. package/dist/{chunk-zywwzf6t.js → chunk-nvr0ph6b.js} +4 -4
  65. package/dist/{chunk-02n071n7.js → chunk-p4wvc7wx.js} +4 -4
  66. package/dist/{chunk-y438dzvn.js → chunk-ptjqacjd.js} +2 -2
  67. package/dist/{chunk-12pvnn1e.js → chunk-pxqs3psa.js} +4 -4
  68. package/dist/{chunk-hnx1jgfp.js → chunk-q5433grh.js} +1 -1
  69. package/dist/{chunk-4dvb6crf.js → chunk-qrzhpzdw.js} +1 -1
  70. package/dist/chunk-r089d1s4.js +2 -0
  71. package/dist/{chunk-3b61yd4r.js → chunk-r2ahyhj0.js} +1 -1
  72. package/dist/chunk-sbs74y50.js +2 -0
  73. package/dist/chunk-st6exqqv.js +2 -0
  74. package/dist/{chunk-k8sqs7j2.js → chunk-t7x753ga.js} +2 -2
  75. package/dist/{chunk-2gxe5pj7.js → chunk-tf11gc47.js} +1 -1
  76. package/dist/{chunk-c0ants8t.js → chunk-thx147nq.js} +3 -3
  77. package/dist/chunk-tmj5b3r0.js +2 -0
  78. package/dist/{chunk-6t7mxb0b.js → chunk-tywmtk33.js} +2 -2
  79. package/dist/chunk-v190nt4m.js +2 -0
  80. package/dist/{chunk-rqfhknzj.js → chunk-veqzjwty.js} +1 -1
  81. package/dist/chunk-vn8qdcxp.js +2 -0
  82. package/dist/{chunk-cf6htz63.js → chunk-vzek2z1v.js} +1 -1
  83. package/dist/{chunk-jp602m75.js → chunk-w6gyrqjp.js} +18 -19
  84. package/dist/chunk-w7zh2avv.js +2 -0
  85. package/dist/chunk-w926gc13.js +2 -0
  86. package/dist/chunk-weegyd19.js +2 -0
  87. package/dist/{chunk-k0v70ttf.js → chunk-x3vv7hhh.js} +1 -1
  88. package/dist/{chunk-hpjtjd0c.js → chunk-x6cyhkk6.js} +1 -1
  89. package/dist/{chunk-wrj5fcvb.js → chunk-x819gynv.js} +4 -4
  90. package/dist/{chunk-e7n9gzf4.js → chunk-xc6x218s.js} +4 -4
  91. package/dist/chunk-ynrnx1tp.js +2 -0
  92. package/dist/{chunk-tz3v9sdj.js → chunk-z0t6509y.js} +8 -8
  93. package/dist/chunk-zc6k6164.js +2 -0
  94. package/dist/chunk-zgj9fsrd.js +2 -0
  95. package/dist/cli.js +16 -16
  96. package/dist/client-parameter-bindings.d.ts +4 -0
  97. package/dist/client-parameter-bindings.js +131 -0
  98. package/dist/client-script-bundler.js +27 -1
  99. package/dist/client-script.js +8 -2
  100. package/dist/craft-entry.js +2 -2
  101. package/dist/craft.js +2 -2
  102. package/dist/native/compiler/html-to-ir.js +2 -0
  103. package/dist/native/runtime/native-host.js +1 -0
  104. package/dist/pwa.js +3 -3
  105. package/dist/runtime-globals.d.ts +2 -1
  106. package/dist/runtime-globals.js +1 -1
  107. package/dist/signals.js +17 -18
  108. package/dist/ssg.js +3 -3
  109. package/package.json +5 -5
  110. package/dist/chunk-18rtxwty.js +0 -2
  111. package/dist/chunk-2xdqkskn.js +0 -2
  112. package/dist/chunk-5egy805h.js +0 -2
  113. package/dist/chunk-61gkb7kj.js +0 -2
  114. package/dist/chunk-66acqgyj.js +0 -2
  115. package/dist/chunk-7534j756.js +0 -2
  116. package/dist/chunk-9d53d0t6.js +0 -2
  117. package/dist/chunk-a1wag3ds.js +0 -2
  118. package/dist/chunk-ahgrkva8.js +0 -2
  119. package/dist/chunk-akbb6j7s.js +0 -2
  120. package/dist/chunk-bfk9vd0v.js +0 -2
  121. package/dist/chunk-d20xsth5.js +0 -2
  122. package/dist/chunk-d9hwqs78.js +0 -2
  123. package/dist/chunk-dx2nvsb9.js +0 -2
  124. package/dist/chunk-dxvh9qea.js +0 -2
  125. package/dist/chunk-e1yags7g.js +0 -2
  126. package/dist/chunk-f29rsb4g.js +0 -2
  127. package/dist/chunk-fdz00v9y.js +0 -2
  128. package/dist/chunk-fk1qnh5n.js +0 -2
  129. package/dist/chunk-ga18rt5h.js +0 -2
  130. package/dist/chunk-hr0b9xec.js +0 -2
  131. package/dist/chunk-j67ns7p6.js +0 -17
  132. package/dist/chunk-k1pjb22z.js +0 -2
  133. package/dist/chunk-mkzxhfae.js +0 -2
  134. package/dist/chunk-mqbknfvt.js +0 -2
  135. package/dist/chunk-nswshvzg.js +0 -2
  136. package/dist/chunk-rhkx17d9.js +0 -2
  137. package/dist/chunk-rwrbcam0.js +0 -2
  138. package/dist/chunk-s6dfjx5d.js +0 -2
  139. package/dist/chunk-tznejj9h.js +0 -2
  140. package/dist/chunk-vkhrkt58.js +0 -2
  141. package/dist/chunk-whdw6dhb.js +0 -2
  142. package/dist/chunk-wx7kfet5.js +0 -2
  143. package/dist/chunk-x38d7mvy.js +0 -2
  144. package/dist/chunk-xtmfcav4.js +0 -2
  145. package/dist/chunk-yjgbxf26.js +0 -2
@@ -0,0 +1,131 @@
1
+ import { stripCommentsAndLiterals } from "./strip-literals.js";
2
+ let cachedSource = "", cached;
3
+ const identifier = /^[A-Za-z_$][\w$]*$/, controls = new Set(["if", "for", "while", "switch", "with"]);
4
+ function tokenize(source) {
5
+ const code = stripCommentsAndLiterals(source), tokens = [];
6
+ for (const match of code.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)) {
7
+ const start = match.index ?? 0;
8
+ tokens.push({ text: match[0], start, end: start + match[0].length });
9
+ }
10
+ return { code, tokens };
11
+ }
12
+ function analyze(source) {
13
+ if (cached && source === cachedSource)
14
+ return cached;
15
+ const { code, tokens } = tokenize(source), pairs = new Map, stack = [];
16
+ for (let index = 0;index < tokens.length; index++) {
17
+ const token = tokens[index].text;
18
+ if (["(", "[", "{"].includes(token))
19
+ stack.push(index);
20
+ else if ([")", "]", "}"].includes(token)) {
21
+ const open = stack.at(-1);
22
+ if (open !== void 0 && ["()", "[]", "{}"].includes(tokens[open].text + token)) {
23
+ stack.pop();
24
+ pairs.set(open, index);
25
+ pairs.set(index, open);
26
+ }
27
+ }
28
+ }
29
+ function parts(start, end) {
30
+ const result = [];
31
+ let begin = start;
32
+ for (let index = start;index < end; index++) {
33
+ if (["(", "[", "{"].includes(tokens[index].text) && (pairs.get(index) ?? end) < end) {
34
+ index = pairs.get(index);
35
+ continue;
36
+ }
37
+ if (tokens[index].text === ",") {
38
+ result.push([begin, index]);
39
+ begin = index + 1;
40
+ }
41
+ }
42
+ result.push([begin, end]);
43
+ return result;
44
+ }
45
+ function pattern(start, end, names) {
46
+ if (tokens[start]?.text === "...")
47
+ start++;
48
+ if (start >= end)
49
+ return;
50
+ const first = tokens[start].text;
51
+ if (identifier.test(first)) {
52
+ names.add(first);
53
+ return;
54
+ }
55
+ if (first !== "{" && first !== "[")
56
+ return;
57
+ const close = pairs.get(start);
58
+ if (close === void 0 || close >= end)
59
+ return;
60
+ for (const [begin, finish] of parts(start + 1, close)) {
61
+ let binding = begin;
62
+ if (first === "{")
63
+ for (let index = begin;index < finish; index++) {
64
+ if (tokens[index].text === ":") {
65
+ binding = index + 1;
66
+ break;
67
+ }
68
+ if (tokens[index].text === "=")
69
+ break;
70
+ if (["(", "[", "{"].includes(tokens[index].text) && pairs.has(index))
71
+ index = pairs.get(index);
72
+ }
73
+ pattern(binding, finish, names);
74
+ }
75
+ }
76
+ function parameterNames(start, end) {
77
+ const names = new Set;
78
+ for (const [begin, finish] of parts(start, end))
79
+ pattern(begin, finish, names);
80
+ return names;
81
+ }
82
+ function expressionEnd(start) {
83
+ let index = start;
84
+ for (;index < tokens.length; index++) {
85
+ const token = tokens[index].text;
86
+ if (["(", "[", "{"].includes(token) && pairs.has(index)) {
87
+ index = pairs.get(index);
88
+ continue;
89
+ }
90
+ if ([",", ";", ")", "]", "}"].includes(token))
91
+ break;
92
+ }
93
+ return tokens[Math.max(start, index - 1)]?.end ?? code.length;
94
+ }
95
+ const scopes = [];
96
+ for (let index = 0;index < tokens.length; index++)
97
+ if (tokens[index].text === "=>") {
98
+ const previous = index - 1;
99
+ let begin = previous, names;
100
+ if (tokens[previous]?.text === ")" && pairs.has(previous)) {
101
+ begin = pairs.get(previous);
102
+ names = parameterNames(begin + 1, previous);
103
+ } else if (tokens[previous] && identifier.test(tokens[previous].text))
104
+ names = new Set([tokens[previous].text]);
105
+ else
106
+ continue;
107
+ const body = index + 1, end = tokens[body]?.text === "{" && pairs.has(body) ? tokens[pairs.get(body)].end : expressionEnd(body);
108
+ scopes.push({ start: tokens[begin].start, end, names });
109
+ } else if (tokens[index].text === "(" && pairs.has(index)) {
110
+ const previous = tokens[index - 1]?.text;
111
+ if (!previous || controls.has(previous) || !identifier.test(previous) && previous !== "*" && previous !== "]")
112
+ continue;
113
+ const close = pairs.get(index);
114
+ let body = close + 1;
115
+ if (tokens[body]?.text === ":") {
116
+ body++;
117
+ while (body < tokens.length && !["{", "=>", ";", "="].includes(tokens[body].text))
118
+ body++;
119
+ }
120
+ if (tokens[body]?.text !== "{" || !pairs.has(body))
121
+ continue;
122
+ scopes.push({ start: tokens[index].start, end: tokens[pairs.get(body)].end, names: parameterNames(index + 1, close) });
123
+ }
124
+ cachedSource = source;
125
+ cached = { code, scopes };
126
+ return cached;
127
+ }
128
+ export function parameterAnalysis(source) {
129
+ const analysis = analyze(source);
130
+ return { code: analysis.code, shadows: (name, offset) => analysis.scopes.some((scope) => offset >= scope.start && offset < scope.end && scope.names.has(name)) };
131
+ }
@@ -8,7 +8,7 @@ import { config, loadStxConfig } from "./config.js";
8
8
  import { isServerApiSource } from "./server-api.js";
9
9
  import { depsUnchanged, renderMemo } from "./render-memo.js";
10
10
  import { bracketDepths, stripCommentsAndLiterals } from "./strip-literals.js";
11
- const BUNDLE_CACHE_VERSION = 9;
11
+ const BUNDLE_CACHE_VERSION = 10;
12
12
  function isPrivateClientSource(file, root, serverApi) {
13
13
  return /^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(path.basename(file)) || isServerApiSource(file, root, serverApi);
14
14
  }
@@ -381,6 +381,32 @@ async function buildBundle(code, filePath, options) {
381
381
  continue;
382
382
  declNames.add(dm[2]);
383
383
  }
384
+ const importRegex = /^[ \t]*import\s+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;
385
+ while ((dm = importRegex.exec(strippedForScan)) !== null) {
386
+ if (!isTopLevel(dm.index))
387
+ continue;
388
+ const source = /^\s*['"]([^'"]+)['"]/.exec(code.slice(dm.index + dm[0].length))?.[1];
389
+ if (source && EXTERNAL_PATTERNS.some((pattern) => pattern.test(source)))
390
+ continue;
391
+ if (dm[1])
392
+ declNames.add(dm[1]);
393
+ if (dm[2])
394
+ declNames.add(dm[2]);
395
+ for (const entry of (dm[3] ?? "").split(",")) {
396
+ const binding = entry.trim();
397
+ if (!binding || /^type\s/.test(binding))
398
+ continue;
399
+ const local = /\bas\s+(\w+)\s*$/.exec(binding)?.[1] ?? /^\w+$/.exec(binding)?.[0];
400
+ if (local)
401
+ declNames.add(local);
402
+ }
403
+ }
404
+ for (const declaration of strippedForScan.matchAll(/\bexport\s*\{([^}]+)\}/g))
405
+ for (const entry of declaration[1].split(",")) {
406
+ const publicName = /\bas\s+(\w+)\s*$/.exec(entry)?.[1] ?? /^\s*(\w+)\s*$/.exec(entry)?.[1];
407
+ if (publicName)
408
+ declNames.delete(publicName);
409
+ }
384
410
  const exportLine = declNames.size > 0 ? `
385
411
  export { ${[...declNames].join(", ")} }` : "";
386
412
  await Bun.write(tmpEntry, code + exportLine);
@@ -3,6 +3,7 @@ import fs from "node:fs";
3
3
  import { asInvocableStatement, listensPassively } from "./events.js";
4
4
  import { transformStoreImports } from "./store-imports.js";
5
5
  import { declaresClientIdentifier } from "./client-declarations.js";
6
+ import { parameterAnalysis } from "./client-parameter-bindings.js";
6
7
  import { findInterpolationEnd, stripCommentsAndLiterals } from "./strip-literals.js";
7
8
  export { findInterpolationEnd, stripCommentsAndLiterals } from "./strip-literals.js";
8
9
  import { shouldTranspileTypeScript, transpileTypeScript } from "./utils.js";
@@ -300,7 +301,7 @@ export function transformAutoImports(code) {
300
301
  for (const symbol of STX_AUTO_IMPORTS) {
301
302
  if (existingImports.has(symbol) || locallyDeclared.has(symbol))
302
303
  continue;
303
- if (new RegExp(`\\b${symbol}\\s*(?:<[^>]*>)?\\s*\\(`, "g").test(transformedCode))
304
+ if (referencesName(transformedCode, symbol, !0))
304
305
  usedStxImports.add(symbol);
305
306
  }
306
307
  const searchableForBrowser = stripCommentsAndLiterals(transformedCode), importedFromAnywhere = new Set;
@@ -330,9 +331,14 @@ export function transformAutoImports(code) {
330
331
  };
331
332
  }
332
333
  export function referencesName(code, name, call = !1) {
334
+ const analysis = parameterAnalysis(code);
335
+ code = analysis.code;
333
336
  const pattern = new RegExp(`\\b${name.replace(/[$]/g, "\\$")}\\b`, "g");
334
337
  for (const match of code.matchAll(pattern)) {
335
- const start = match.index ?? 0, end = start + name.length;
338
+ const start = match.index ?? 0;
339
+ if (analysis.shadows(name, start))
340
+ continue;
341
+ const end = start + name.length;
336
342
  let before = start - 1;
337
343
  while (before >= 0 && /\s/.test(code[before]))
338
344
  before--;
@@ -1,9 +1,9 @@
1
1
  // @bun
2
- import{Lr,xi,Si}from"./chunk-0hhq9hbq.js";import"./chunk-5f0r0g18.js";import"./chunk-3ry9ca1s.js";import"./chunk-12pvnn1e.js";import"./chunk-w3j0ppg4.js";import"./chunk-axydabse.js";import"./chunk-dsxgv6g2.js";import"./chunk-mjgqhhap.js";import"./chunk-fb7bfyjz.js";import"./chunk-y438dzvn.js";import"./chunk-be01xyb8.js";import"./chunk-b7973zvk.js";import"./chunk-k8sqs7j2.js";import{ou,gi,au,cu,mi,Nr,hi,lu,yi,uu,du,bi,wi,vi}from"./chunk-tz3v9sdj.js";import"./chunk-e7n9gzf4.js";import"./chunk-ktedzx9e.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
2
+ import{Lr,Si,ki}from"./chunk-74j5jbs6.js";import"./chunk-b9wpgn7b.js";import"./chunk-8x47zcfa.js";import"./chunk-pxqs3psa.js";import"./chunk-1yj3p63h.js";import"./chunk-axydabse.js";import"./chunk-9jr7jbgv.js";import"./chunk-721yq8qx.js";import"./chunk-my3jkpv7.js";import"./chunk-ptjqacjd.js";import"./chunk-8bew5svs.js";import"./chunk-114zdbnd.js";import"./chunk-t7x753ga.js";import{ou,mi,au,cu,hi,Nr,yi,lu,bi,uu,du,wi,vi,xi}from"./chunk-z0t6509y.js";import"./chunk-xc6x218s.js";import"./chunk-8wkja2z2.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
3
3
  `),scripts:t.scripts.join(`
4
4
  `),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
5
5
  `),scripts:t.scripts.join(`
6
6
  `),hydrationData:i,metadata:{renderTime:s,cacheHit:!1,totalSize:a.length,componentCount:t.metadata.componentCount}}}function V(t,e){let n=[],r=[],a=[],i=new Map,s=[];return y(t.tree,(o,c)=>{if(o.type==="component"&&o.componentName){if(T(o.componentName))n.push(o.componentName)}if(o.type==="element"&&o.tag){let p=J(o);if(p)s.push(p);if(o.props){for(let[l,f]of Object.entries(o.props))if(l.startsWith("on")&&typeof f==="string"){let g=`handler_${i.size}`;i.set(g,f)}}}if(o.isStatic&&o.type==="element")r.push(b(o));else if(!o.isStatic&&o.type!=="text")a.push(o.tag||o.componentName||"unknown")}),{nativeComponents:n,staticHTML:r,dynamicParts:a,eventHandlers:i,nativeWidgets:s}}function Y(t,e={}){let n=R(t),r=P(n,e),a=new Map,i=[];return y(n.tree,(s)=>{if(s.type==="component"&&s.componentName){if(T(s.componentName)){i.push(s.componentName);let o=`<!--craft:${s.componentName}:${s.hydrationKey||"default"}-->`;a.set(s.hydrationKey||s.componentName,o)}}}),{staticHTML:r,dynamicPlaceholders:a,craftComponents:i}}function M(t){let e={type:"fragment",children:[]},n=e,r=[e],a=t,i=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(a.length>0){let s=a.match(/^<(@?[\w-]+)([^>]*)>/);if(s){let[p,l,f]=s,g=z(f),u=l.startsWith("@craft-"),C=u?l:l.toLowerCase(),S={type:u?"component":"element",tag:C,props:g,children:[],componentName:u?C.slice(1):void 0,isStatic:!v(f),hydrationKey:F()};if(n.children=n.children||[],n.children.push(S),!i.has(C)&&!f.endsWith("/"))r.push(S),n=S;a=a.slice(p.length);continue}let o=a.match(/^<\/(@?[\w-]+)>/);if(o){let[p,l]=o,g=l.startsWith("@craft-")?l:l.toLowerCase();while(r.length>1){let u=r.pop();if(n=r[r.length-1],u.tag===g)break}a=a.slice(p.length);continue}let c=a.match(/^[^<]+/);if(c){let p=c[0];if(p.trim()){let l={type:"text",text:p,isStatic:!v(p)};n.children=n.children||[],n.children.push(l)}a=a.slice(p.length);continue}a=a.slice(1)}return e}function z(t){let e={},n=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,r;while((r=n.exec(t))!==null){let[,a,i,s,o]=r,c=i??s??o??!0;e[a]=c}return e}function y(t,e,n=[]){if(e(t,n),t.children)t.children.forEach((r,a)=>{y(r,e,[...n,`${a}`])})}function h(t,e){switch(t.type){case"text":return x(t.text||"",e);case"element":case"component":{let n=t.tag||"div",r=N(t.props||{},e),a=(t.children||[]).map((i)=>h(i,e)).join("");if(!t.children||t.children.length===0){if(["input","br","hr","img","meta","link"].includes(n))return`<${n}${r} />`}return`<${n}${r}>${a}</${n}>`}case"fragment":return(t.children||[]).map((n)=>h(n,e)).join("");case"slot":return`<!--slot:${t.slotName||"default"}-->`;default:return""}}function b(t){if(t.type==="text")return t.text||"";let e=t.tag||"div",n=N(t.props||{},{});return`<${e}${n}></${e}>`}function N(t,e){let n=[];for(let[r,a]of Object.entries(t))if(a===!0)n.push(` ${r}`);else if(a!==!1&&a!==null&&a!==void 0){let i=x(String(a),e);n.push(` ${r}="${k(i)}"`)}return n.join("")}async function H(t,e){return h(t,e)}function P(t,e){let n=[];return y(t.tree,(r)=>{if(r.isStatic)n.push(h(r,e))}),n.join("")}function j(t,e,n){let r={templateId:e.id,context:n,dynamicParts:Array.from(e.dynamicParts.entries())},a=`
7
7
  <script data-craft-hydration>
8
8
  window.__CRAFT_HYDRATION__ = ${JSON.stringify(r)};
9
- </script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{ou as CRAFT_BRIDGE_SCRIPT,Nr as CRAFT_COMPONENTS,lu as CRAFT_COMPONENT_RUNTIME,hi as CRAFT_COMPONENT_STYLES,Lr as NATIVE_COMPONENTS,bi as buildNative,B as clearAllCaches,q as clearRenderCache,U as clearTemplateCache,R as compileTemplate,xi as compileToNative,Si as createHotReloadServer,gi as generateCraftBridgeScript,V as generateCraftOptimizations,vi as getAvailableFormats,wi as getAvailableTargets,du as getCraftComponents,G as getSSRCacheStats,mi as injectCraftBridge,au as isCraftEnvironment,Y as prerenderForCraft,yi as processCraftComponents,cu as processCraftDirective,uu as registerCraftComponent,Q as renderSSR};
9
+ </script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{ou as CRAFT_BRIDGE_SCRIPT,Nr as CRAFT_COMPONENTS,lu as CRAFT_COMPONENT_RUNTIME,yi as CRAFT_COMPONENT_STYLES,Lr as NATIVE_COMPONENTS,wi as buildNative,B as clearAllCaches,q as clearRenderCache,U as clearTemplateCache,R as compileTemplate,Si as compileToNative,ki as createHotReloadServer,mi as generateCraftBridgeScript,V as generateCraftOptimizations,xi as getAvailableFormats,vi as getAvailableTargets,du as getCraftComponents,G as getSSRCacheStats,hi as injectCraftBridge,au as isCraftEnvironment,Y as prerenderForCraft,bi as processCraftComponents,cu as processCraftDirective,uu as registerCraftComponent,Q as renderSSR};
package/dist/craft.js CHANGED
@@ -1,9 +1,9 @@
1
1
  // @bun
2
- import{Lr,xi,Si}from"./chunk-0hhq9hbq.js";import"./chunk-5f0r0g18.js";import"./chunk-3ry9ca1s.js";import"./chunk-12pvnn1e.js";import"./chunk-w3j0ppg4.js";import"./chunk-axydabse.js";import"./chunk-dsxgv6g2.js";import"./chunk-mjgqhhap.js";import"./chunk-fb7bfyjz.js";import"./chunk-y438dzvn.js";import"./chunk-be01xyb8.js";import"./chunk-b7973zvk.js";import"./chunk-k8sqs7j2.js";import{ou,gi,au,cu,mi,Nr,hi,lu,yi,uu,du,bi,wi,vi}from"./chunk-tz3v9sdj.js";import"./chunk-e7n9gzf4.js";import"./chunk-ktedzx9e.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
2
+ import{Lr,Si,ki}from"./chunk-74j5jbs6.js";import"./chunk-b9wpgn7b.js";import"./chunk-8x47zcfa.js";import"./chunk-pxqs3psa.js";import"./chunk-1yj3p63h.js";import"./chunk-axydabse.js";import"./chunk-9jr7jbgv.js";import"./chunk-721yq8qx.js";import"./chunk-my3jkpv7.js";import"./chunk-ptjqacjd.js";import"./chunk-8bew5svs.js";import"./chunk-114zdbnd.js";import"./chunk-t7x753ga.js";import{ou,mi,au,cu,hi,Nr,yi,lu,bi,uu,du,wi,vi,xi}from"./chunk-z0t6509y.js";import"./chunk-xc6x218s.js";import"./chunk-8wkja2z2.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
3
3
  `),scripts:t.scripts.join(`
4
4
  `),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
5
5
  `),scripts:t.scripts.join(`
6
6
  `),hydrationData:i,metadata:{renderTime:s,cacheHit:!1,totalSize:a.length,componentCount:t.metadata.componentCount}}}function V(t,e){let n=[],r=[],a=[],i=new Map,s=[];return y(t.tree,(o,c)=>{if(o.type==="component"&&o.componentName){if(T(o.componentName))n.push(o.componentName)}if(o.type==="element"&&o.tag){let p=J(o);if(p)s.push(p);if(o.props){for(let[l,f]of Object.entries(o.props))if(l.startsWith("on")&&typeof f==="string"){let g=`handler_${i.size}`;i.set(g,f)}}}if(o.isStatic&&o.type==="element")r.push(b(o));else if(!o.isStatic&&o.type!=="text")a.push(o.tag||o.componentName||"unknown")}),{nativeComponents:n,staticHTML:r,dynamicParts:a,eventHandlers:i,nativeWidgets:s}}function Y(t,e={}){let n=R(t),r=P(n,e),a=new Map,i=[];return y(n.tree,(s)=>{if(s.type==="component"&&s.componentName){if(T(s.componentName)){i.push(s.componentName);let o=`<!--craft:${s.componentName}:${s.hydrationKey||"default"}-->`;a.set(s.hydrationKey||s.componentName,o)}}}),{staticHTML:r,dynamicPlaceholders:a,craftComponents:i}}function M(t){let e={type:"fragment",children:[]},n=e,r=[e],a=t,i=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(a.length>0){let s=a.match(/^<(@?[\w-]+)([^>]*)>/);if(s){let[p,l,f]=s,g=z(f),u=l.startsWith("@craft-"),C=u?l:l.toLowerCase(),S={type:u?"component":"element",tag:C,props:g,children:[],componentName:u?C.slice(1):void 0,isStatic:!v(f),hydrationKey:F()};if(n.children=n.children||[],n.children.push(S),!i.has(C)&&!f.endsWith("/"))r.push(S),n=S;a=a.slice(p.length);continue}let o=a.match(/^<\/(@?[\w-]+)>/);if(o){let[p,l]=o,g=l.startsWith("@craft-")?l:l.toLowerCase();while(r.length>1){let u=r.pop();if(n=r[r.length-1],u.tag===g)break}a=a.slice(p.length);continue}let c=a.match(/^[^<]+/);if(c){let p=c[0];if(p.trim()){let l={type:"text",text:p,isStatic:!v(p)};n.children=n.children||[],n.children.push(l)}a=a.slice(p.length);continue}a=a.slice(1)}return e}function z(t){let e={},n=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,r;while((r=n.exec(t))!==null){let[,a,i,s,o]=r,c=i??s??o??!0;e[a]=c}return e}function y(t,e,n=[]){if(e(t,n),t.children)t.children.forEach((r,a)=>{y(r,e,[...n,`${a}`])})}function h(t,e){switch(t.type){case"text":return x(t.text||"",e);case"element":case"component":{let n=t.tag||"div",r=N(t.props||{},e),a=(t.children||[]).map((i)=>h(i,e)).join("");if(!t.children||t.children.length===0){if(["input","br","hr","img","meta","link"].includes(n))return`<${n}${r} />`}return`<${n}${r}>${a}</${n}>`}case"fragment":return(t.children||[]).map((n)=>h(n,e)).join("");case"slot":return`<!--slot:${t.slotName||"default"}-->`;default:return""}}function b(t){if(t.type==="text")return t.text||"";let e=t.tag||"div",n=N(t.props||{},{});return`<${e}${n}></${e}>`}function N(t,e){let n=[];for(let[r,a]of Object.entries(t))if(a===!0)n.push(` ${r}`);else if(a!==!1&&a!==null&&a!==void 0){let i=x(String(a),e);n.push(` ${r}="${k(i)}"`)}return n.join("")}async function H(t,e){return h(t,e)}function P(t,e){let n=[];return y(t.tree,(r)=>{if(r.isStatic)n.push(h(r,e))}),n.join("")}function j(t,e,n){let r={templateId:e.id,context:n,dynamicParts:Array.from(e.dynamicParts.entries())},a=`
7
7
  <script data-craft-hydration>
8
8
  window.__CRAFT_HYDRATION__ = ${JSON.stringify(r)};
9
- </script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{ou as CRAFT_BRIDGE_SCRIPT,Nr as CRAFT_COMPONENTS,lu as CRAFT_COMPONENT_RUNTIME,hi as CRAFT_COMPONENT_STYLES,Lr as NATIVE_COMPONENTS,bi as buildNative,B as clearAllCaches,q as clearRenderCache,U as clearTemplateCache,R as compileTemplate,xi as compileToNative,Si as createHotReloadServer,gi as generateCraftBridgeScript,V as generateCraftOptimizations,vi as getAvailableFormats,wi as getAvailableTargets,du as getCraftComponents,G as getSSRCacheStats,mi as injectCraftBridge,au as isCraftEnvironment,Y as prerenderForCraft,yi as processCraftComponents,cu as processCraftDirective,uu as registerCraftComponent,Q as renderSSR};
9
+ </script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{ou as CRAFT_BRIDGE_SCRIPT,Nr as CRAFT_COMPONENTS,lu as CRAFT_COMPONENT_RUNTIME,yi as CRAFT_COMPONENT_STYLES,Lr as NATIVE_COMPONENTS,wi as buildNative,B as clearAllCaches,q as clearRenderCache,U as clearTemplateCache,R as compileTemplate,Si as compileToNative,ki as createHotReloadServer,mi as generateCraftBridgeScript,V as generateCraftOptimizations,xi as getAvailableFormats,vi as getAvailableTargets,du as getCraftComponents,G as getSSRCacheStats,hi as injectCraftBridge,au as isCraftEnvironment,Y as prerenderForCraft,bi as processCraftComponents,cu as processCraftDirective,uu as registerCraftComponent,Q as renderSSR};
@@ -15,6 +15,7 @@ const DROP_SUBTREE = new Set(["script", "style", "head", "meta", "link", "title"
15
15
  focusout: "onBlur",
16
16
  submit: "onSubmitEditing",
17
17
  scroll: "onScroll",
18
+ refresh: "onRefresh",
18
19
  close: "onRequestClose"
19
20
  };
20
21
  export const NATIVE_EVENTS = new Set([
@@ -26,6 +27,7 @@ export const NATIVE_EVENTS = new Set([
26
27
  "onLongPress",
27
28
  "onPress",
28
29
  "onRequestClose",
30
+ "onRefresh",
29
31
  "onScroll",
30
32
  "onValueChange"
31
33
  ]);
@@ -28,6 +28,7 @@ const NATIVE_EVENT_NAMES = {
28
28
  focusout: "onBlur",
29
29
  submit: "onSubmitEditing",
30
30
  scroll: "onScroll",
31
+ refresh: "onRefresh",
31
32
  close: "onRequestClose"
32
33
  };
33
34
  export function createNativeHost(options) {
package/dist/pwa.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{An,Ie,Ai,Da}from"./chunk-0bmc75w6.js";import{Rn,jr,Aa,Pa,Ia}from"./chunk-sbdzqqr1.js";import{Ti,_i,Ri,_a,Ra}from"./chunk-cznsm2n3.js";import{ie,pt,Br}from"./chunk-p2x7tjbt.js";import{Mc,Nc,Lc,jc,cr,nd}from"./chunk-hnep9jbj.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-d9hwqs78.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{An,Ie,Pi,Da}from"./chunk-7x8qwshk.js";import{Rn,jr,Aa,Pa,Ia}from"./chunk-m607bd3m.js";import{_i,Ri,Ai,_a,Ra}from"./chunk-489z8wry.js";import{ie,pt,Br}from"./chunk-p2x7tjbt.js";import{Mc,Nc,Lc,jc,cr,nd}from"./chunk-hnep9jbj.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-et2kt16p.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=ie(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=An(n,t);if(a){let s=Ie(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 jr(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,_i as auditBuildOutput,Ti as auditConfig,re as buildPwaAssets,Ri as calculateAuditResult,Ra as formatAuditResult,Br as formatSize,j as generateManifest,_ as generateManifestJson,Pa as generateManifestLink,F as generateOfflinePage,ie as generatePrecacheManifest,pt as generatePrecacheManifestJs,M as generatePwaIcons,Rn as generatePwaTags,An as generateServiceWorker,Da as generateServiceWorkerAuto,Aa as generateSwRegistrationScript,Ia as generateThemeColorMeta,N as getExpectedIconPaths,Ie as getServiceWorkerFileName,jr as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,Ai as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,cr as pwaDirectives,Mc as pwaInstallDirective,Lc as pwaOfflineDirective,jc as pwaPushDirective,Nc as pwaUpdateDirective,nd as registerPwaDirectives,_a 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=ie(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=An(n,t);if(a){let s=Ie(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 jr(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,Ri as auditBuildOutput,_i as auditConfig,re as buildPwaAssets,Ai as calculateAuditResult,Ra as formatAuditResult,Br as formatSize,j as generateManifest,_ as generateManifestJson,Pa as generateManifestLink,F as generateOfflinePage,ie as generatePrecacheManifest,pt as generatePrecacheManifestJs,M as generatePwaIcons,Rn as generatePwaTags,An as generateServiceWorker,Da as generateServiceWorkerAuto,Aa as generateSwRegistrationScript,Ia as generateThemeColorMeta,N as getExpectedIconPaths,Ie as getServiceWorkerFileName,jr as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,Pi as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,cr as pwaDirectives,Mc as pwaInstallDirective,Lc as pwaOfflineDirective,jc as pwaPushDirective,Nc as pwaUpdateDirective,nd as registerPwaDirectives,_a as runPwaAudit,D as validateManifest};
@@ -239,7 +239,8 @@ export declare function runtimeDirectiveNamesLiteral(): string;
239
239
  /**
240
240
  * Event names a bare `:name` or `@name` is read as a listener for.
241
241
  *
242
- * Prefix-matched, so `click` also covers `click.stop` and `click.prevent`.
242
+ * A dot starts event modifiers, so `click.stop` matches but `scroll-target`
243
+ * remains an attribute binding.
243
244
  */
244
245
  export declare const RUNTIME_EVENT_NAMES: readonly string[];
245
246
  /** The `EVENT_RE` the generated runtime embeds, as JS source. */
@@ -251,7 +251,7 @@ export const RUNTIME_EVENT_NAMES = [
251
251
  "pointermove"
252
252
  ];
253
253
  export function runtimeEventRegexLiteral() {
254
- return `/^(${RUNTIME_EVENT_NAMES.join("|")})/`;
254
+ return `/^(${RUNTIME_EVENT_NAMES.join("|")})(?:\\.|$)/`;
255
255
  }
256
256
  export function isRuntimeEventName(name) {
257
257
  return RUNTIME_EVENT_NAMES.some((event) => name === event || name.startsWith(`${event}.`));
package/dist/signals.js CHANGED
@@ -82,6 +82,8 @@ console.log('[stx] entering IIFE');
82
82
  var stxHost = window.__stx_host || {
83
83
  setText: function(node, value) { node.textContent = value; },
84
84
  setAttribute: function(node, name, value) {
85
+ if (value === false) { node.removeAttribute(name); return; }
86
+ if (value === true) { node.setAttribute(name, ''); return; }
85
87
  var next = value;
86
88
  if (typeof value === 'object' && value !== null) {
87
89
  try { next = JSON.stringify(value); }
@@ -2711,23 +2713,16 @@ catch (e) {
2711
2713
  value = undefined;
2712
2714
  }
2713
2715
 
2714
- // ARIA states are strings, unlike HTML boolean attributes.
2716
+ // Preserve native prop types; the DOM host reflects boolean presence
2717
+ // and serializes structured values at its own boundary.
2715
2718
  if (name.startsWith('aria-') && typeof value === 'boolean') {
2716
- el.setAttribute(name, String(value));
2719
+ stxHost.setAttribute(el, name, String(value));
2717
2720
  }
2718
- else if (value === false || value === null || value === undefined) {
2719
- el.removeAttribute(name);
2720
- }
2721
- else if (value === true) {
2722
- el.setAttribute(name, '');
2721
+ else if (value === null || value === undefined) {
2722
+ stxHost.removeAttribute(el, name);
2723
2723
  }
2724
2724
  else {
2725
- var serialized = value;
2726
- if (typeof value === 'object') {
2727
- try { serialized = JSON.stringify(value); }
2728
- catch (e) { serialized = String(value); }
2729
- }
2730
- el.setAttribute(name, serialized);
2725
+ stxHost.setAttribute(el, name, value);
2731
2726
  }
2732
2727
  // The component setup scope is already registered for normal and
2733
2728
  // cloned signal components. Update its prop signal directly so object
@@ -3326,13 +3321,13 @@ catch (e2) {
3326
3321
  return;
3327
3322
  }
3328
3323
  if (attrName.startsWith('aria-') && typeof v === 'boolean') {
3329
- el.setAttribute(attrName, String(v));
3324
+ stxHost.setAttribute(el, attrName, String(v));
3330
3325
  }
3331
- else if (v === false || v === null || v === undefined) {
3332
- stxHost.removeAttribute(el, attrName);
3326
+ else if (typeof v === 'boolean') {
3327
+ stxHost.setAttribute(el, attrName, v);
3333
3328
  }
3334
- else if (v === true) {
3335
- el.setAttribute(attrName, '');
3329
+ else if (v === null || v === undefined) {
3330
+ stxHost.removeAttribute(el, attrName);
3336
3331
  }
3337
3332
  else {
3338
3333
  var attrValue = v;
@@ -4903,6 +4898,10 @@ catch (e) {
4903
4898
  var FOR_ATTRS = [':for', 'x-for', '@for'];
4904
4899
  function deferRowConditionals(root) {
4905
4900
  if (!root || !root.querySelectorAll || typeof document === 'undefined' || !document.createElement) return;
4901
+ // Inert HTML template content is a DOM allocation optimisation. Native
4902
+ // hosts already clone recorded descriptors and bind conditions through
4903
+ // their host operations; their document facade has no template content.
4904
+ if (!document.createElement('template').content) return;
4906
4905
  // A walk, not a selector: escaping ':' and '@' in an attribute selector
4907
4906
  // through this generated source is easy to get wrong, and wrong throws.
4908
4907
  var candidates = Array.prototype.slice.call(root.querySelectorAll('*'));
package/dist/ssg.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-5f0r0g18.js";import"./chunk-3ry9ca1s.js";import{Qe,et,tt,nt,rt,st}from"./chunk-12pvnn1e.js";import"./chunk-w3j0ppg4.js";import"./chunk-axydabse.js";import{f,je,M,q,n,i}from"./chunk-dsxgv6g2.js";import"./chunk-mjgqhhap.js";import{Yn}from"./chunk-fb7bfyjz.js";import"./chunk-y438dzvn.js";import"./chunk-be01xyb8.js";import"./chunk-b7973zvk.js";import"./chunk-k8sqs7j2.js";import"./chunk-19mnptan.js";import{oe,ft,gt}from"./chunk-j67ns7p6.js";import{Ci,$i,Ei}from"./chunk-c1dmr865.js";import{dt,Xt,Gt}from"./chunk-yd50awqp.js";import"./chunk-ktedzx9e.js";import{a}from"./chunk-wtms9jhs.js";import x from"fs";import g from"path";import{createHash as $t}from"crypto";function Dt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Rt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function kt(t){return Bun.hash(t).toString(16)}function lt(t,s={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let o=new Map,r=t.replace(Rt,(e,l,w,y)=>{let h=y.trim();if(!h)return e;if(/\bdata-stx-src=/.test(w))return e;if(s.minify)h=Dt(h);let S=kt(h);if(!o.has(S))o.set(S,h);let P=s.integrity?` data-stx-integrity="sha384-${$t("sha384").update(h).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${l}" data-stx-src="/_stx/islands/${S}.js"${P}${w}></script>`}),c=Array.from(o,([e,l])=>({hash:e,code:l}));return{html:r,chunks:c}}var Ct=new Set(["visible","idle"]);function ut(t){if(!t.includes("data-stx-src="))return t;let s=new Map,o=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,r;while((r=o.exec(t))!==null)s.set(r[1],r[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,l;while((l=e.exec(t))!==null)if(Ct.has(s.get(l[1])||""))c.add(l[2]);let w=t.lastIndexOf("</head>");if(c.size===0||w===-1)return t;let y=Array.from(c).filter((h)=>!t.includes(`rel="prefetch" href="${h}"`)).map((h)=>`<link rel="prefetch" href="${h}" as="script">`).join("");if(!y)return t;return t.slice(0,w)+y+t.slice(w)}var Et=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function J(t){let s=t.trim();if(!s)return null;let o=/^https?:\/\//i.test(s)?s:`https://${s}`;try{return new URL(o).origin+new URL(o).pathname.replace(/\/$/,"")}catch{return null}}function It(t){for(let s of Et){let o=t[s];if(!o)continue;let r=J(o);if(r)return{url:r,source:"env",via:s}}return null}function pt(t){if(!t||typeof t!=="object")return null;let s=t,o=s.site?.url??s.url??s.app?.url;return typeof o==="string"?J(o):null}async function Bt(t){let{existsSync:s}=await import("fs"),o=await import("path");for(let r of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=o.resolve(t,r);if(!s(c))continue;try{let e=await import(c),l=pt(e.default??e);if(l)return l}catch{}}return null}async function ht(t={}){let s=t.cwd??process.cwd(),o=t.env??process.env;if(t.explicit){let l=J(t.explicit);if(l)return{url:l,source:"option"}}let r=pt(t.stxConfig);if(r)return{url:r,source:"stx.config",via:"site.url"};let c=await Bt(s);if(c)return{url:c,source:"site.config",via:"url"};let e=It(o);if(e)return e;return{url:"http://localhost",source:"fallback"}}function mt(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
2
+ import"./chunk-b9wpgn7b.js";import"./chunk-8x47zcfa.js";import{Qe,et,tt,nt,rt,st}from"./chunk-pxqs3psa.js";import"./chunk-1yj3p63h.js";import"./chunk-axydabse.js";import{f,je,M,q,n,i}from"./chunk-9jr7jbgv.js";import"./chunk-721yq8qx.js";import{Yn}from"./chunk-my3jkpv7.js";import"./chunk-ptjqacjd.js";import"./chunk-8bew5svs.js";import"./chunk-114zdbnd.js";import"./chunk-t7x753ga.js";import"./chunk-d2z6tmzw.js";import{oe,ft,gt}from"./chunk-begfdc6a.js";import{$i,Ei,Ti}from"./chunk-ccq35xp7.js";import{dt,Xt,Gt}from"./chunk-yd50awqp.js";import"./chunk-8wkja2z2.js";import{a}from"./chunk-wtms9jhs.js";import x from"fs";import g from"path";import{createHash as $t}from"crypto";function Dt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Rt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function kt(t){return Bun.hash(t).toString(16)}function lt(t,s={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let o=new Map,r=t.replace(Rt,(e,l,w,y)=>{let h=y.trim();if(!h)return e;if(/\bdata-stx-src=/.test(w))return e;if(s.minify)h=Dt(h);let S=kt(h);if(!o.has(S))o.set(S,h);let P=s.integrity?` data-stx-integrity="sha384-${$t("sha384").update(h).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${l}" data-stx-src="/_stx/islands/${S}.js"${P}${w}></script>`}),c=Array.from(o,([e,l])=>({hash:e,code:l}));return{html:r,chunks:c}}var Ct=new Set(["visible","idle"]);function ut(t){if(!t.includes("data-stx-src="))return t;let s=new Map,o=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,r;while((r=o.exec(t))!==null)s.set(r[1],r[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,l;while((l=e.exec(t))!==null)if(Ct.has(s.get(l[1])||""))c.add(l[2]);let w=t.lastIndexOf("</head>");if(c.size===0||w===-1)return t;let y=Array.from(c).filter((h)=>!t.includes(`rel="prefetch" href="${h}"`)).map((h)=>`<link rel="prefetch" href="${h}" as="script">`).join("");if(!y)return t;return t.slice(0,w)+y+t.slice(w)}var Et=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function J(t){let s=t.trim();if(!s)return null;let o=/^https?:\/\//i.test(s)?s:`https://${s}`;try{return new URL(o).origin+new URL(o).pathname.replace(/\/$/,"")}catch{return null}}function It(t){for(let s of Et){let o=t[s];if(!o)continue;let r=J(o);if(r)return{url:r,source:"env",via:s}}return null}function pt(t){if(!t||typeof t!=="object")return null;let s=t,o=s.site?.url??s.url??s.app?.url;return typeof o==="string"?J(o):null}async function Bt(t){let{existsSync:s}=await import("fs"),o=await import("path");for(let r of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=o.resolve(t,r);if(!s(c))continue;try{let e=await import(c),l=pt(e.default??e);if(l)return l}catch{}}return null}async function ht(t={}){let s=t.cwd??process.cwd(),o=t.env??process.env;if(t.explicit){let l=J(t.explicit);if(l)return{url:l,source:"option"}}let r=pt(t.stxConfig);if(r)return{url:r,source:"stx.config",via:"site.url"};let c=await Bt(s);if(c)return{url:c,source:"site.config",via:"url"};let e=It(o);if(e)return e;return{url:"http://localhost",source:"fallback"}}function mt(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
3
3
  `)}class wt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,s=""){this.cacheDir=t,this.salt=s}async load(){if(this.loaded)return;let t=g.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let s=JSON.parse(await Bun.file(t).text());for(let[o,r]of Object.entries(s))this.cache.set(o,r)}catch{}this.loaded=!0}async save(){await x.promises.mkdir(this.cacheDir,{recursive:!0});let t=g.join(this.cacheDir,"build-cache.json"),s={};for(let[o,r]of this.cache)s[o]=r;await Bun.write(t,JSON.stringify(s))}getHash(t,s){let o=x.statSync(t),r=`${this.salt}|${t}:${o.mtimeMs}`;for(let e of s)if(x.existsSync(e)){let l=x.statSync(e);r+=`:${e}:${l.mtimeMs}`}let c=0;for(let e=0;e<r.length;e++){let l=r.charCodeAt(e);c=(c<<5)-c+l,c=c&c}return Math.abs(c).toString(36)}get(t,s){let o=this.cache.get(t);if(!o)return null;let r=this.getHash(s,o.dependencies??[]);if(o.hash!==r)return this.cache.delete(t),null;return o.html}set(t,s,o,r){let c=this.getHash(s,o);this.cache.set(t,{hash:c,html:r,generatedAt:Date.now(),dependencies:o})}}class yt{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let s=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return g.join(this.cacheDir,"isr",s)}async get(t){let s=this.getFilePath(t);if(!await Bun.file(s).exists())return null;try{return JSON.parse(await Bun.file(s).text())}catch{return null}}async set(t,s){let o=this.getFilePath(t);await x.promises.mkdir(g.dirname(o),{recursive:!0}),await Bun.write(o,JSON.stringify(s))}async invalidate(t){let s=this.getFilePath(t);if(await Bun.file(s).exists())await x.promises.unlink(s)}async invalidatePattern(t){let s=g.join(this.cacheDir,"isr");if(!x.existsSync(s))return;let o=await x.promises.readdir(s);for(let r of o){let c=r.replace(/_/g,"/").replace(".json","");if(t.test(c))await x.promises.unlink(g.join(s,r))}}async needsRevalidation(t){let s=await this.get(t);if(!s)return!0;return Date.now()>s.revalidateAfter}}async function jt(t){try{let o=(await Bun.file(t).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let r=o[1];if(!r.includes("getStaticPaths"))return null;let c=r.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!c)return null;return await Function(`
4
4
  return (async function getStaticPaths() {
5
5
  ${c[1]}
@@ -41,7 +41,7 @@ ${t.map((r)=>{let c=new URL(r.loc,s).href,e=` <url>
41
41
  ${o.join(`
42
42
  `)}
43
43
  </channel>
44
- </rss>`}async function zt(t={}){let s=Date.now();gt();let o=await i(process.cwd()),r=o.build||{},c=await ht({explicit:t.domain||r.domain,stxConfig:o});if(c.source==="fallback"&&(t.sitemap??r.sitemap??!0))console.warn(mt());let e={router:t.router??o?.router??{},pagesDir:t.pagesDir||r.pagesDir||"pages",outputDir:t.outputDir||r.outputDir||"dist",baseUrl:t.baseUrl||r.baseUrl||"/",domain:c.url,revalidate:t.revalidate??r.revalidate??!1,sitemap:t.sitemap??r.sitemap??!0,sitemapExclude:t.sitemapExclude||r.sitemapExclude||[],robots:t.robots??r.robots??!0,rss:t.rss??r.rss??!1,concurrency:t.concurrency||r.concurrency||10,cache:t.cache??r.cache??!0,cacheDir:t.cacheDir||r.cacheDir||a(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??r.minify??!0,generate404:t.generate404??r.generate404??!0,publicDir:t.publicDir||r.publicDir||"public",trailingSlash:t.trailingSlash??r.trailingSlash??!1,cleanOutput:t.cleanOutput??r.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||o?.partialsDir||"",componentsDir:t.componentsDir||o?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},l={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},w=new Set,y=0,h={},S={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&x.existsSync(e.outputDir))await x.promises.rm(e.outputDir,{recursive:!0});await x.promises.mkdir(e.outputDir,{recursive:!0});let D=e.cacheSalt;if(!D){let{resolveUserCssConfig:u,fingerprintConfig:m}=await import("./chunk-2xdqkskn.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-hr0b9xec.js"),b=await p(e.publicDir,e.outputDir);if(b.count>0)console.log(`Optimized ${b.count} image(s) for responsive delivery`),D=[D,b.fingerprint].filter(Boolean).join(":");let B=new wt(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-2xdqkskn.js");await u('<div class="bg-black"></div>')}catch{}Qe();let xt=o?.routeMiddleware?.dir||"middleware";await tt(process.cwd(),xt);let H=et();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let vt=o?.routeMiddleware?.global||[];Ei(o?.layoutsDir,a(process.cwd()));let K=M(".",{pagesDir:e.pagesDir,pagesDirs:o?._layerPageDirs});console.log(`Found ${K.length} routes`);let G=[];for(let u of K){let m=await Ft(u);for(let v of m)G.push({route:u,url:v.url,params:v.params,props:v.props,revalidate:v.revalidate??e.revalidate})}l.totalPages=G.length,console.log(`Generating ${l.totalPages} pages...`);let A=[],X=[];for(let u=0;u<G.length;u+=e.concurrency)X.push(G.slice(u,u+e.concurrency));for(let u of X)await Promise.all(u.map(async(m)=>{let{route:v,url:d,params:L,props:bt,revalidate:Q}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Jt(j),Pt=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],it=[...vt,...Pt];if(it.length>0){let C=nt(d,L,F||{}),O=rt(C,null,void 0,{isServer:!0}),E=await st(it,O);if(E.redirect){let R=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,_=Vt(String(R),d),T=Kt(d,e);await x.promises.mkdir(g.dirname(T),{recursive:!0}),await Bun.write(T,_),l.successCount++,l.pages.push({route:d,outputPath:T,size:Buffer.byteLength(_),cached:!1}),A.push({loc:d,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${d} \u2192 redirect to ${R}`);return}if(E.abort){let R=typeof E.abort==="string"?E.abort:E.abort?.error?.message||"aborted";console.warn(` \u21B3 ${d} \u2014 middleware aborted: ${R}`);return}}let at=j.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(at)try{if(!await Function("route",`
44
+ </rss>`}async function zt(t={}){let s=Date.now();gt();let o=await i(process.cwd()),r=o.build||{},c=await ht({explicit:t.domain||r.domain,stxConfig:o});if(c.source==="fallback"&&(t.sitemap??r.sitemap??!0))console.warn(mt());let e={router:t.router??o?.router??{},pagesDir:t.pagesDir||r.pagesDir||"pages",outputDir:t.outputDir||r.outputDir||"dist",baseUrl:t.baseUrl||r.baseUrl||"/",domain:c.url,revalidate:t.revalidate??r.revalidate??!1,sitemap:t.sitemap??r.sitemap??!0,sitemapExclude:t.sitemapExclude||r.sitemapExclude||[],robots:t.robots??r.robots??!0,rss:t.rss??r.rss??!1,concurrency:t.concurrency||r.concurrency||10,cache:t.cache??r.cache??!0,cacheDir:t.cacheDir||r.cacheDir||a(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??r.minify??!0,generate404:t.generate404??r.generate404??!0,publicDir:t.publicDir||r.publicDir||"public",trailingSlash:t.trailingSlash??r.trailingSlash??!1,cleanOutput:t.cleanOutput??r.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||o?.partialsDir||"",componentsDir:t.componentsDir||o?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},l={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},w=new Set,y=0,h={},S={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&x.existsSync(e.outputDir))await x.promises.rm(e.outputDir,{recursive:!0});await x.promises.mkdir(e.outputDir,{recursive:!0});let D=e.cacheSalt;if(!D){let{resolveUserCssConfig:u,fingerprintConfig:m}=await import("./chunk-8bpf8d7n.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-4x884b3c.js"),b=await p(e.publicDir,e.outputDir);if(b.count>0)console.log(`Optimized ${b.count} image(s) for responsive delivery`),D=[D,b.fingerprint].filter(Boolean).join(":");let B=new wt(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-8bpf8d7n.js");await u('<div class="bg-black"></div>')}catch{}Qe();let xt=o?.routeMiddleware?.dir||"middleware";await tt(process.cwd(),xt);let H=et();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let vt=o?.routeMiddleware?.global||[];Ti(o?.layoutsDir,a(process.cwd()));let K=M(".",{pagesDir:e.pagesDir,pagesDirs:o?._layerPageDirs});console.log(`Found ${K.length} routes`);let G=[];for(let u of K){let m=await Ft(u);for(let v of m)G.push({route:u,url:v.url,params:v.params,props:v.props,revalidate:v.revalidate??e.revalidate})}l.totalPages=G.length,console.log(`Generating ${l.totalPages} pages...`);let A=[],X=[];for(let u=0;u<G.length;u+=e.concurrency)X.push(G.slice(u,u+e.concurrency));for(let u of X)await Promise.all(u.map(async(m)=>{let{route:v,url:d,params:L,props:bt,revalidate:Q}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Jt(j),Pt=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],it=[...vt,...Pt];if(it.length>0){let C=nt(d,L,F||{}),O=rt(C,null,void 0,{isServer:!0}),E=await st(it,O);if(E.redirect){let R=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,_=Vt(String(R),d),T=Kt(d,e);await x.promises.mkdir(g.dirname(T),{recursive:!0}),await Bun.write(T,_),l.successCount++,l.pages.push({route:d,outputPath:T,size:Buffer.byteLength(_),cached:!1}),A.push({loc:d,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${d} \u2192 redirect to ${R}`);return}if(E.abort){let R=typeof E.abort==="string"?E.abort:E.abort?.error?.message||"aborted";console.warn(` \u21B3 ${d} \u2014 middleware aborted: ${R}`);return}}let at=j.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(at)try{if(!await Function("route",`
45
45
  const validate = ${at[1]};
46
46
  return validate(route);
47
47
  `)({params:L})){console.warn(`Validation failed for ${d}, skipping...`);return}}catch{}let k=null,ot=!1;if(e.cache){if(k=B.get(d,v.filePath),k)ot=!0,l.cachedCount++}if(!k){let C=await St(v,L,bt,e,o);if(k=C.html,e.failOnIncludeError&&C.includeFailures.length>0)throw Error(`${C.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
@@ -73,7 +73,7 @@ ${u}`)}if(e.cache)await B.save();if(e.generate404){let u=g.join(e.pagesDir,"404.
73
73
  <a href="/">Go home</a>
74
74
  </div>
75
75
  </body>
76
- </html>`)}for(let u of[500]){let m=g.join(e.pagesDir,`${u}.stx`);if(await Bun.file(m).exists()){let v=new Set,d={...o,debug:!1,cache:!1},L=await n(await Bun.file(m).text(),{},m,d,v);await Bun.write(g.join(e.outputDir,`${u}.html`),L)}}let W=g.join(e.pagesDir,"error.stx");if(await Bun.file(W).exists()){let u=new Set,m={...o,debug:!1,cache:!1},v=await n(await Bun.file(W).text(),{},W,m,u);await Bun.write(g.join(e.outputDir,"error.html"),v)}if(e.sitemap&&A.length>0){let u=_t(A,e.domain),m=g.join(e.outputDir,"sitemap.xml");await Bun.write(m,u),l.sitemapPath=m,console.log(`Generated sitemap.xml with ${A.length} URLs`)}if(e.robots!==!1){let u=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((d)=>typeof d==="string"),...u.disallow||[]],v=Yn({rules:[{userAgent:u.userAgent||"*",allow:u.allow||["/"],...m.length>0?{disallow:m}:{}}],...u.sitemap!==!1&&l.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(g.join(e.outputDir,"robots.txt"),v),console.log("Generated robots.txt")}if(e.rss){let u=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(u.getItems)m=await u.getItems();let v=Nt(u,m),d=g.join(e.outputDir,"rss.xml");await Bun.write(d,v),l.rssPath=d,console.log(`Generated rss.xml with ${m.length} items`)}let N=Ci(e.outputDir);if(N.assets>0)console.log(`Externalized ${N.assets} asset(s) from ${N.pages} page(s) (${(N.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let z=$i(e.outputDir);if(z.assets>0)console.log(`Externalized ${z.assets} repeated asset(s) from ${z.pages} page(s) (${(z.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&x.existsSync(e.publicDir))await V(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let Z=Gt();if(Z)await V(Z,g.join(e.outputDir,Xt)),console.log(`Copied assets from ${dt}`)}catch(D){throw await e.hooks.onError?.(D),D}if(l.buildTime=Date.now()-s,w.size>0){l.islandChunks={count:w.size,totalBytes:y};let D={generatedChunks:w.size,totalBytes:y,chunks:h,pages:S};await Bun.write(g.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(D,null,2))}await e.hooks.onBuildEnd?.(l);let P=l.islandChunks?`
76
+ </html>`)}for(let u of[500]){let m=g.join(e.pagesDir,`${u}.stx`);if(await Bun.file(m).exists()){let v=new Set,d={...o,debug:!1,cache:!1},L=await n(await Bun.file(m).text(),{},m,d,v);await Bun.write(g.join(e.outputDir,`${u}.html`),L)}}let W=g.join(e.pagesDir,"error.stx");if(await Bun.file(W).exists()){let u=new Set,m={...o,debug:!1,cache:!1},v=await n(await Bun.file(W).text(),{},W,m,u);await Bun.write(g.join(e.outputDir,"error.html"),v)}if(e.sitemap&&A.length>0){let u=_t(A,e.domain),m=g.join(e.outputDir,"sitemap.xml");await Bun.write(m,u),l.sitemapPath=m,console.log(`Generated sitemap.xml with ${A.length} URLs`)}if(e.robots!==!1){let u=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((d)=>typeof d==="string"),...u.disallow||[]],v=Yn({rules:[{userAgent:u.userAgent||"*",allow:u.allow||["/"],...m.length>0?{disallow:m}:{}}],...u.sitemap!==!1&&l.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(g.join(e.outputDir,"robots.txt"),v),console.log("Generated robots.txt")}if(e.rss){let u=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(u.getItems)m=await u.getItems();let v=Nt(u,m),d=g.join(e.outputDir,"rss.xml");await Bun.write(d,v),l.rssPath=d,console.log(`Generated rss.xml with ${m.length} items`)}let N=$i(e.outputDir);if(N.assets>0)console.log(`Externalized ${N.assets} asset(s) from ${N.pages} page(s) (${(N.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let z=Ei(e.outputDir);if(z.assets>0)console.log(`Externalized ${z.assets} repeated asset(s) from ${z.pages} page(s) (${(z.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&x.existsSync(e.publicDir))await V(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let Z=Gt();if(Z)await V(Z,g.join(e.outputDir,Xt)),console.log(`Copied assets from ${dt}`)}catch(D){throw await e.hooks.onError?.(D),D}if(l.buildTime=Date.now()-s,w.size>0){l.islandChunks={count:w.size,totalBytes:y};let D={generatedChunks:w.size,totalBytes:y,chunks:h,pages:S};await Bun.write(g.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(D,null,2))}await e.hooks.onBuildEnd?.(l);let P=l.islandChunks?`
77
77
  Island chunks: ${l.islandChunks.count} (${(l.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
78
78
  Build complete!
79
79
  Total: ${l.totalPages} pages
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.432",
4
+ "version": "0.2.434",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -122,12 +122,12 @@
122
122
  "dependencies": {
123
123
  "@stacksjs/ts-css": "^0.3.2",
124
124
  "@stacksjs/clapp": "^0.2.16",
125
- "@stacksjs/desktop": "0.2.432",
126
- "@stacksjs/sanitizer": "0.2.432",
125
+ "@stacksjs/desktop": "0.2.434",
126
+ "@stacksjs/sanitizer": "0.2.434",
127
127
  "@stacksjs/ts-i18n": "^0.1.11",
128
- "bun-plugin-stx": "0.2.432",
128
+ "bun-plugin-stx": "0.2.434",
129
129
  "bunfig": "^0.15.19",
130
- "stx-router": "0.2.432",
130
+ "stx-router": "0.2.434",
131
131
  "ts-broadcasting": "^0.0.11",
132
132
  "ts-images": "^0.2.22",
133
133
  "ts-syntax-highlighter": "^0.2.1"
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Vl,Ul}from"./chunk-2gxe5pj7.js";import"./chunk-j67ns7p6.js";import"./chunk-19mnptan.js";import"./chunk-dsxgv6g2.js";import"./chunk-ktedzx9e.js";import"./chunk-3ry9ca1s.js";import"./chunk-k8sqs7j2.js";import"./chunk-be01xyb8.js";import"./chunk-y438dzvn.js";import"./chunk-fb7bfyjz.js";import"./chunk-mjgqhhap.js";import"./chunk-5f0r0g18.js";import"./chunk-axydabse.js";import"./chunk-w3j0ppg4.js";import"./chunk-12pvnn1e.js";import"./chunk-b7973zvk.js";export{Ul as clearStoreCache,Vl as getStoreScript};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Ru,Fi,Au,zi,Ja,Ya,vt,en,Pu,Za,Qa,ec,f}from"./chunk-dsxgv6g2.js";import"./chunk-ktedzx9e.js";import"./chunk-3ry9ca1s.js";import"./chunk-k8sqs7j2.js";import"./chunk-be01xyb8.js";import"./chunk-y438dzvn.js";import"./chunk-fb7bfyjz.js";import"./chunk-mjgqhhap.js";import"./chunk-5f0r0g18.js";import"./chunk-axydabse.js";import"./chunk-w3j0ppg4.js";import"./chunk-12pvnn1e.js";import"./chunk-b7973zvk.js";export{vt as buildCss,Za as extractClassNames,Ya as fingerprintConfig,Qa as generateCss,Pu as getCachedCSS,Ru as getCssServeAsset,f as injectCss,Fi as loadCssEngine,zi as loadCssEngineConfig,en as rebuildCss,Au as resetCssCache,Ja as resolveUserCssConfig,ec as withLinkedModuleBundles};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{tn,tc,Zr}from"./chunk-dsxgv6g2.js";import"./chunk-ktedzx9e.js";import"./chunk-3ry9ca1s.js";import"./chunk-k8sqs7j2.js";import"./chunk-be01xyb8.js";import"./chunk-y438dzvn.js";import"./chunk-fb7bfyjz.js";import"./chunk-mjgqhhap.js";import{ve}from"./chunk-5f0r0g18.js";import"./chunk-axydabse.js";import"./chunk-w3j0ppg4.js";import"./chunk-12pvnn1e.js";import"./chunk-b7973zvk.js";export{ve as freeIdentifiers,Zr as processComponents,tc as processESImports,tn as rendersAsElement};