@stacksjs/stx 0.2.606 → 0.2.607

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 (63) hide show
  1. package/dist/{chunk-y6gj9jq8.js → chunk-0cb00ys2.js} +1 -1
  2. package/dist/{chunk-605c6zks.js → chunk-0mgth7cm.js} +1 -1
  3. package/dist/{chunk-3cnwstra.js → chunk-1dd4qefr.js} +1 -1
  4. package/dist/{chunk-915s0may.js → chunk-2n59ahd9.js} +1 -1
  5. package/dist/{chunk-3gm6013p.js → chunk-2pwjnydp.js} +1 -1
  6. package/dist/chunk-32hr3qq7.js +2 -0
  7. package/dist/{chunk-ajd5w5c4.js → chunk-39pgf5z3.js} +1 -1
  8. package/dist/{chunk-r4wqh5fd.js → chunk-3xwzd9wp.js} +18 -18
  9. package/dist/{chunk-c0h9cxew.js → chunk-4szajb1z.js} +1 -1
  10. package/dist/{chunk-rg7wvcqw.js → chunk-5j29466h.js} +1 -1
  11. package/dist/{chunk-zs3tmd12.js → chunk-60wedefh.js} +1 -1
  12. package/dist/{chunk-bkjre6xk.js → chunk-61ztfana.js} +2 -2
  13. package/dist/{chunk-4dfqgmgs.js → chunk-77kpsnf6.js} +5 -5
  14. package/dist/{chunk-fwp1en28.js → chunk-79edpvb2.js} +1 -1
  15. package/dist/{chunk-61d0gr5b.js → chunk-7f63z4xx.js} +1 -1
  16. package/dist/{chunk-fese2cf6.js → chunk-8bzx0r0x.js} +1 -1
  17. package/dist/{chunk-y9a9cvke.js → chunk-8fq6bvnw.js} +1 -1
  18. package/dist/{chunk-1veeefpn.js → chunk-974dxazw.js} +1 -1
  19. package/dist/chunk-9sgt7v77.js +2 -0
  20. package/dist/{chunk-pndhb1nk.js → chunk-9zzhpp2a.js} +1 -1
  21. package/dist/{chunk-d0kes50w.js → chunk-aan7601v.js} +1 -1
  22. package/dist/{chunk-mtxs4fya.js → chunk-aestp72s.js} +1 -1
  23. package/dist/{chunk-n882b1fy.js → chunk-bakxqwnz.js} +1 -1
  24. package/dist/{chunk-vvfpb3k3.js → chunk-bspryr4a.js} +2 -2
  25. package/dist/{chunk-9zwdpa7p.js → chunk-c48mh4d6.js} +2 -2
  26. package/dist/{chunk-vhajhs44.js → chunk-c65q0svd.js} +1 -1
  27. package/dist/{chunk-tyb481p0.js → chunk-cp901m61.js} +1 -1
  28. package/dist/{chunk-vm2d4hap.js → chunk-dxqwm8tr.js} +1 -1
  29. package/dist/{chunk-5taenpfg.js → chunk-ev6w9c69.js} +1 -1
  30. package/dist/{chunk-k7spjpr0.js → chunk-exd1h9sd.js} +1 -1
  31. package/dist/{chunk-9734nkc8.js → chunk-g04y5wyn.js} +1 -1
  32. package/dist/{chunk-mn7a5b55.js → chunk-g63ye3fe.js} +1 -1
  33. package/dist/{chunk-y8jjmwa9.js → chunk-k4wkfhvz.js} +1 -1
  34. package/dist/{chunk-327bt8zb.js → chunk-mgj0ngyq.js} +1 -1
  35. package/dist/{chunk-gk7mmc2e.js → chunk-n39ezmxz.js} +1 -1
  36. package/dist/{chunk-qygr4pv8.js → chunk-n8eavnxf.js} +1 -1
  37. package/dist/{chunk-dzekcand.js → chunk-pghtgep5.js} +1 -1
  38. package/dist/{chunk-8t3c2myr.js → chunk-rxja040z.js} +1 -1
  39. package/dist/chunk-sx0qbekt.js +2 -0
  40. package/dist/{chunk-en388k3h.js → chunk-t83acmv2.js} +1 -1
  41. package/dist/{chunk-y2wr7c9e.js → chunk-tc176d93.js} +1 -1
  42. package/dist/{chunk-htf3z9et.js → chunk-tfjcs55e.js} +1 -1
  43. package/dist/{chunk-s45envb5.js → chunk-wqmm1qsz.js} +2 -2
  44. package/dist/{chunk-cw76y2p5.js → chunk-wtax276j.js} +1 -1
  45. package/dist/{chunk-93na8hh0.js → chunk-x49qdt4c.js} +1 -1
  46. package/dist/{chunk-8x2ejkcc.js → chunk-y0zyzbjf.js} +1 -1
  47. package/dist/{chunk-w67rrd1f.js → chunk-z2xrwmjr.js} +1 -1
  48. package/dist/{chunk-3ttnn4t3.js → chunk-zq345s76.js} +1 -1
  49. package/dist/cli.js +7 -7
  50. package/dist/craft-entry.js +1 -1
  51. package/dist/craft.js +1 -1
  52. package/dist/native/compiler/html-to-ir.js +1 -0
  53. package/dist/native/compiler/ir.d.ts +1 -1
  54. package/dist/native/components/primitives.d.ts +33 -11
  55. package/dist/native/event-names.js +1 -0
  56. package/dist/native/prop-names.js +3 -1
  57. package/dist/pwa.js +1 -1
  58. package/dist/server-bindings.js +5 -2
  59. package/dist/ssg.js +2 -2
  60. package/package.json +5 -5
  61. package/dist/chunk-1e28n9q2.js +0 -2
  62. package/dist/chunk-kgvm5ytn.js +0 -2
  63. package/dist/chunk-mfery7a4.js +0 -2
@@ -41,10 +41,17 @@ export declare interface BaseProps {
41
41
  testID?: string
42
42
  accessibilityLabel?: string
43
43
  accessibilityHint?: string
44
+ accessibilityValue?: string | number
45
+ accessibilityState?: AccessibilityState
44
46
  accessibilityRole?: AccessibilityRole
45
47
  listRole?: 'header' | 'item' | 'separator' | 'empty' | 'footer'
46
48
  transitionID?: string
47
49
  }
50
+ export declare interface AccessibilityState {
51
+ disabled?: boolean
52
+ selected?: boolean
53
+ checked?: boolean
54
+ }
48
55
  // ============================================================================
49
56
  // Layout Components
50
57
  // ============================================================================
@@ -52,18 +59,20 @@ export declare interface ViewProps extends BaseProps {
52
59
  onPress?: () => void
53
60
  onLongPress?: () => void
54
61
  onLayout?: (event: LayoutEvent) => void
55
- pointerEvents?: 'auto' | 'none' | 'box-none' | 'box-only'
56
62
  }
57
63
  export declare interface ScrollViewProps extends ViewProps {
58
64
  horizontal?: boolean
59
65
  showsHorizontalScrollIndicator?: boolean
60
66
  showsVerticalScrollIndicator?: boolean
61
67
  bounces?: boolean
68
+ alwaysBounceHorizontal?: boolean
69
+ alwaysBounceVertical?: boolean
62
70
  onScroll?: (event: ScrollEvent) => void
63
71
  onScrollEndDrag?: () => void
64
72
  onMomentumScrollEnd?: () => void
65
73
  contentContainerStyle?: STXStyle
66
74
  keyboardDismissMode?: 'none' | 'on-drag' | 'interactive'
75
+ keyboardShouldPersistTaps?: 'always' | 'handled' | 'never'
67
76
  refreshControl?: RefreshControlProps
68
77
  stickyHeaderIndices?: number[]
69
78
  scrollTarget?: string | { id: string, key?: string | number, animated?: boolean } | null
@@ -93,9 +102,11 @@ export declare interface TextInputProps extends BaseProps {
93
102
  placeholder?: string
94
103
  placeholderTextColor?: string
95
104
  onChangeText?: (text: string) => void
105
+ onChange?: (text: string) => void
96
106
  onFocus?: () => void
97
107
  onBlur?: () => void
98
108
  onSubmitEditing?: () => void
109
+ onEndEditing?: () => void
99
110
  keyboardType?: KeyboardType
100
111
  returnKeyType?: ReturnKeyType
101
112
  autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters'
@@ -104,6 +115,7 @@ export declare interface TextInputProps extends BaseProps {
104
115
  secureTextEntry?: boolean
105
116
  maxLength?: number
106
117
  multiline?: boolean
118
+ numberOfLines?: number
107
119
  editable?: boolean
108
120
  selectionColor?: string
109
121
  textContentType?: string
@@ -143,17 +155,11 @@ export declare interface PressableProps extends ViewProps {
143
155
  disabled?: boolean
144
156
  onPressIn?: () => void
145
157
  onPressOut?: () => void
146
- hitSlop?: number | { top?: number; right?: number; bottom?: number; left?: number }
147
- pressRetentionOffset?: number | { top?: number; right?: number; bottom?: number; left?: number }
148
- android_ripple?: {
149
- color?: string
150
- borderless?: boolean
151
- radius?: number
152
- }
153
158
  }
154
159
  export declare interface SwitchProps extends BaseProps {
155
160
  value?: boolean
156
161
  onValueChange?: (value: boolean) => void
162
+ onChange?: (value: boolean) => void
157
163
  disabled?: boolean
158
164
  trackColor?: { false?: string; true?: string }
159
165
  thumbColor?: string
@@ -166,6 +172,7 @@ export declare interface CheckboxProps extends BaseProps {
166
172
  indeterminate?: boolean
167
173
  label?: string
168
174
  onValueChange?: (value: boolean) => void
175
+ onChange?: (value: boolean) => void
169
176
  disabled?: boolean
170
177
  color?: string
171
178
  }
@@ -175,6 +182,7 @@ export declare interface SliderProps extends BaseProps {
175
182
  maximumValue?: number
176
183
  step?: number
177
184
  onValueChange?: (value: number) => void
185
+ onChange?: (value: number) => void
178
186
  onSlidingComplete?: (value: number) => void
179
187
  disabled?: boolean
180
188
  minimumTrackTintColor?: string
@@ -189,6 +197,7 @@ export declare interface PickerProps extends BaseProps {
189
197
  items: PickerOption[]
190
198
  selectedValue?: string | number
191
199
  onValueChange?: (value: string | number, index: number) => void
200
+ onChange?: (value: string | number, index: number) => void
192
201
  disabled?: boolean
193
202
  }
194
203
  /** A value as `<input type="date|time|datetime-local">` writes it. */
@@ -205,6 +214,7 @@ export declare interface DatePickerProps extends BaseProps {
205
214
  minuteInterval?: number
206
215
  display?: 'compact' | 'inline' | 'wheels'
207
216
  onValueChange?: (event: DatePickerChange) => void
217
+ onChange?: (event: DatePickerChange) => void
208
218
  disabled?: boolean
209
219
  }
210
220
  /** Iconify or SF Symbol rendered by the platform's native icon view. */
@@ -215,20 +225,29 @@ export declare interface IconProps extends BaseProps {
215
225
  }
216
226
  export declare interface ImageProps extends BaseProps {
217
227
  source: ImageSource
218
- resizeMode?: 'cover' | 'contain' | 'stretch' | 'center' | 'repeat'
228
+ alt?: string
229
+ resizeMode?: 'cover' | 'contain' | 'stretch' | 'center'
219
230
  onLoad?: () => void
220
231
  onLoadStart?: () => void
221
232
  onLoadEnd?: () => void
222
- onError?: (error: Error) => void
233
+ onError?: (event: ImageErrorEvent) => void
223
234
  blurRadius?: number
224
235
  fadeDuration?: number
225
236
  defaultSource?: ImageSource
226
237
  }
238
+ export declare interface ImageErrorEvent {
239
+ nativeEvent: {
240
+ error: {
241
+ message: string
242
+ }
243
+ }
244
+ }
227
245
  /** A video drawn by the platform's player (AVPlayer on iOS). */
228
246
  export declare interface VideoProps extends BaseProps {
229
247
  source?: string | { uri: string }
230
248
  src?: string
231
249
  controls?: boolean
250
+ autoPlay?: boolean
232
251
  autoplay?: boolean
233
252
  loop?: boolean
234
253
  muted?: boolean
@@ -323,6 +342,8 @@ export declare interface SectionListProps<T> extends ScrollViewProps {
323
342
  // ============================================================================
324
343
  export declare interface ModalProps extends BaseProps {
325
344
  visible?: boolean
345
+ nonModal?: boolean
346
+ dismissOnOutsideTap?: boolean
326
347
  animationType?: 'none' | 'slide' | 'fade'
327
348
  presentationStyle?: 'fullScreen' | 'pageSheet' | 'formSheet' | 'overFullScreen'
328
349
  transparent?: boolean
@@ -394,6 +415,7 @@ export type AccessibilityRole = | 'none'
394
415
  | 'progressbar'
395
416
  | 'radio'
396
417
  | 'radiogroup'
418
+ | 'list'
397
419
  | 'scrollbar'
398
420
  | 'spinbutton'
399
421
  | 'switch'
@@ -425,5 +447,5 @@ export type ReturnKeyType = | 'done'
425
447
  | 'emergency-call'
426
448
  | 'default';
427
449
  export type ImageSource = | { uri: string; width?: number; height?: number; headers?: Record<string, string> }
428
- | number // require('./image.png');
450
+ | string;
429
451
  export type ComponentName = keyof typeof ComponentRegistry;
@@ -10,6 +10,7 @@ export const NATIVE_EVENT_NAMES = {
10
10
  longpress: "onLongPress",
11
11
  contextmenu: "onLongPress",
12
12
  input: "onChangeText",
13
+ onchange: "onChange",
13
14
  change: "onValueChange",
14
15
  "value-change": "onValueChange",
15
16
  valuechange: "onValueChange",
@@ -25,7 +25,7 @@ const NATIVE_PROP_NAMES = [
25
25
  "hitSlop",
26
26
  "imageStyle",
27
27
  "initialNumToRender",
28
- "iosBackgroundColor",
28
+ "ios_backgroundColor",
29
29
  "keyboardDismissMode",
30
30
  "keyboardShouldPersistTaps",
31
31
  "keyboardType",
@@ -95,6 +95,8 @@ const NATIVE_PROP_NAMES = [
95
95
  "transitionID"
96
96
  ];
97
97
  export const NATIVE_BOOLEAN_PROPS = new Set([
98
+ "alwaysBounceHorizontal",
99
+ "alwaysBounceVertical",
98
100
  "animating",
99
101
  "autoCorrect",
100
102
  "autoFocus",
package/dist/pwa.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  import{er,Ve,ri,uc}from"./chunk-tbsjg23k.js";import{Qn,os,ac,cc,lc}from"./chunk-81qmj3sd.js";import{ei,ti,ni,oc,ic}from"./chunk-tydv84gj.js";import{le,kt,is}from"./chunk-dmdhbwmn.js";import{pl,fl,gl,ml,Ar,Nd}from"./chunk-5s47qfp6.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-dzekcand.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>
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-pghtgep5.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">
@@ -87,7 +87,10 @@ export function processServerBindings(template, context) {
87
87
  while ((match = scriptStyleRegex.exec(template)) !== null)
88
88
  protectedRanges.push([match.index, match.index + match[0].length]);
89
89
  protectedRanges.push(...reactiveLoopRanges(template));
90
- const enclosingLoopNames = new Set(inheritedClientLoopNames(context));
90
+ const clientOwnedNames = new Set([
91
+ ...inheritedClientLoopNames(context),
92
+ ...Array.isArray(context.__stx_client_declared_names) ? context.__stx_client_declared_names : []
93
+ ]);
91
94
  function isProtected(pos) {
92
95
  return protectedRanges.some(([start, end]) => pos >= start && pos < end);
93
96
  }
@@ -104,7 +107,7 @@ export function processServerBindings(template, context) {
104
107
  const attrName = attrMatch[1], expression = attrMatch[2];
105
108
  if (isRuntimeOwnedColonAttr(attrName))
106
109
  continue;
107
- if (readsAnyName(expression, enclosingLoopNames))
110
+ if (readsAnyName(expression, clientOwnedNames))
108
111
  continue;
109
112
  if (expression.includes("()") && !expression.includes(".get(") || expression.includes("$store") || expression.includes("$ref"))
110
113
  continue;
package/dist/ssg.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-s4pjf2pc.js";import"./chunk-06wv8qwy.js";import"./chunk-wzjf33es.js";import{lt,ut,dt,pt,ft,gt}from"./chunk-azpkje69.js";import"./chunk-sswjv8p9.js";import"./chunk-bsy8v1xj.js";import{f,Ke,L,J,n,o}from"./chunk-r4wqh5fd.js";import"./chunk-x8q5przn.js";import{br}from"./chunk-td5100fz.js";import"./chunk-bhf9yt2w.js";import"./chunk-3cnwstra.js";import"./chunk-rmv35cx0.js";import"./chunk-6xsm53pz.js";import"./chunk-vhajhs44.js";import{ue,Ct,_t}from"./chunk-y6gj9jq8.js";import{Yo,Zo,Qo}from"./chunk-cfpenvc7.js";import{St,dn,pn}from"./chunk-rp93n4z7.js";import"./chunk-dnqq1ze0.js";import{a}from"./chunk-n35yc890.js";import x from"fs";import g from"path";import{createHash as Pt}from"crypto";function $t(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Dt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Rt(t){return Bun.hash(t).toString(16)}function it(t,i={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,r=t.replace(Dt,(e,l,w,y)=>{let h=y.trim();if(!h)return e;if(/\bdata-stx-src=/.test(w))return e;if(i.minify)h=$t(h);let S=Rt(h);if(!s.has(S))s.set(S,h);let P=i.integrity?` data-stx-integrity="sha384-${Pt("sha384").update(h).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${l}" data-stx-src="/_stx/islands/${S}.js"${P}${w}></script>`}),c=Array.from(s,([e,l])=>({hash:e,code:l}));return{html:r,chunks:c}}var kt=new Set(["visible","idle"]);function st(t){if(!t.includes("data-stx-src="))return t;let i=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,r;while((r=s.exec(t))!==null)i.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(kt.has(i.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 q(t){let i=t.trim();if(!i)return null;let s=/^https?:\/\//i.test(i)?i:`https://${i}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function It(t){for(let i of Et){let s=t[i];if(!s)continue;let r=q(s);if(r)return{url:r,source:"env",via:i}}return null}function at(t){if(!t||typeof t!=="object")return null;let i=t,s=i.site?.url??i.url??i.app?.url;return typeof s==="string"?q(s):null}async function Bt(t){let{existsSync:i}=await import("fs"),s=await import("path");for(let r of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=s.resolve(t,r);if(!i(c))continue;try{let e=await import(c),l=at(e.default??e);if(l)return l}catch{}}return null}async function ot(t={}){let i=t.cwd??process.cwd(),s=t.env??process.env;if(t.explicit){let l=q(t.explicit);if(l)return{url:l,source:"option"}}let r=at(t.stxConfig);if(r)return{url:r,source:"stx.config",via:"site.url"};let c=await Bt(i);if(c)return{url:c,source:"site.config",via:"url"};let e=It(s);if(e)return e;return{url:"http://localhost",source:"fallback"}}function ct(){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-s4pjf2pc.js";import"./chunk-06wv8qwy.js";import"./chunk-wzjf33es.js";import{lt,ut,dt,pt,ft,gt}from"./chunk-azpkje69.js";import"./chunk-sswjv8p9.js";import"./chunk-bsy8v1xj.js";import{f,Ke,L,J,n,o}from"./chunk-3xwzd9wp.js";import"./chunk-x8q5przn.js";import{br}from"./chunk-td5100fz.js";import"./chunk-bhf9yt2w.js";import"./chunk-1dd4qefr.js";import"./chunk-rmv35cx0.js";import"./chunk-6xsm53pz.js";import"./chunk-c65q0svd.js";import{ue,Ct,_t}from"./chunk-0cb00ys2.js";import{Yo,Zo,Qo}from"./chunk-cfpenvc7.js";import{St,dn,pn}from"./chunk-rp93n4z7.js";import"./chunk-dnqq1ze0.js";import{a}from"./chunk-n35yc890.js";import x from"fs";import g from"path";import{createHash as Pt}from"crypto";function $t(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Dt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Rt(t){return Bun.hash(t).toString(16)}function it(t,i={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,r=t.replace(Dt,(e,l,w,y)=>{let h=y.trim();if(!h)return e;if(/\bdata-stx-src=/.test(w))return e;if(i.minify)h=$t(h);let S=Rt(h);if(!s.has(S))s.set(S,h);let P=i.integrity?` data-stx-integrity="sha384-${Pt("sha384").update(h).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${l}" data-stx-src="/_stx/islands/${S}.js"${P}${w}></script>`}),c=Array.from(s,([e,l])=>({hash:e,code:l}));return{html:r,chunks:c}}var kt=new Set(["visible","idle"]);function st(t){if(!t.includes("data-stx-src="))return t;let i=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,r;while((r=s.exec(t))!==null)i.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(kt.has(i.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 q(t){let i=t.trim();if(!i)return null;let s=/^https?:\/\//i.test(i)?i:`https://${i}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function It(t){for(let i of Et){let s=t[i];if(!s)continue;let r=q(s);if(r)return{url:r,source:"env",via:i}}return null}function at(t){if(!t||typeof t!=="object")return null;let i=t,s=i.site?.url??i.url??i.app?.url;return typeof s==="string"?q(s):null}async function Bt(t){let{existsSync:i}=await import("fs"),s=await import("path");for(let r of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=s.resolve(t,r);if(!i(c))continue;try{let e=await import(c),l=at(e.default??e);if(l)return l}catch{}}return null}async function ot(t={}){let i=t.cwd??process.cwd(),s=t.env??process.env;if(t.explicit){let l=q(t.explicit);if(l)return{url:l,source:"option"}}let r=at(t.stxConfig);if(r)return{url:r,source:"stx.config",via:"site.url"};let c=await Bt(i);if(c)return{url:c,source:"site.config",via:"url"};let e=It(s);if(e)return e;return{url:"http://localhost",source:"fallback"}}function ct(){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 ht{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,i=""){this.cacheDir=t,this.salt=i}async load(){if(this.loaded)return;let t=g.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let i=JSON.parse(await Bun.file(t).text());for(let[s,r]of Object.entries(i))this.cache.set(s,r)}catch{}this.loaded=!0}async save(){await x.promises.mkdir(this.cacheDir,{recursive:!0});let t=g.join(this.cacheDir,"build-cache.json"),i={};for(let[s,r]of this.cache)i[s]=r;await Bun.write(t,JSON.stringify(i))}getHash(t,i){let s=x.statSync(t),r=`${this.salt}|${t}:${s.mtimeMs}`;for(let e of i)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,i){let s=this.cache.get(t);if(!s)return null;let r=this.getHash(i,s.dependencies??[]);if(s.hash!==r)return this.cache.delete(t),null;return s.html}set(t,i,s,r){let c=this.getHash(i,s);this.cache.set(t,{hash:c,html:r,generatedAt:Date.now(),dependencies:s})}}class mt{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let i=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return g.join(this.cacheDir,"isr",i)}async get(t){let i=this.getFilePath(t);if(!await Bun.file(i).exists())return null;try{return JSON.parse(await Bun.file(i).text())}catch{return null}}async set(t,i){let s=this.getFilePath(t);await x.promises.mkdir(g.dirname(s),{recursive:!0}),await Bun.write(s,JSON.stringify(i))}async invalidate(t){let i=this.getFilePath(t);if(await Bun.file(i).exists())await x.promises.unlink(i)}async invalidatePattern(t){let i=g.join(this.cacheDir,"isr");if(!x.existsSync(i))return;let s=await x.promises.readdir(i);for(let r of s){let c=r.replace(/_/g,"/").replace(".json","");if(t.test(c))await x.promises.unlink(g.join(i,r))}}async needsRevalidation(t){let i=await this.get(t);if(!i)return!0;return Date.now()>i.revalidateAfter}}async function jt(t){try{let s=(await Bun.file(t).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!s)return null;let r=s[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,i).href,e=` <url>
41
41
  ${s.join(`
42
42
  `)}
43
43
  </channel>
44
- </rss>`}async function zt(t={}){let i=Date.now();_t();let s=await o(process.cwd()),r=s.build||{},c=await ot({explicit:t.domain||r.domain,stxConfig:s});if(c.source==="fallback"&&(t.sitemap??r.sitemap??!0))console.warn(ct());let e={router:t.router??s?.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||s?.partialsDir||"",componentsDir:t.componentsDir||s?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},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-c0h9cxew.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-y8jjmwa9.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 ht(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-c0h9cxew.js");await u('<div class="bg-black"></div>')}catch{}lt();let yt=s?.routeMiddleware?.dir||"middleware";await dt(process.cwd(),yt);let H=ut();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let xt=s?.routeMiddleware?.global||[];Qo(s?.layoutsDir,a(process.cwd()));let K=L(".",{pagesDir:e.pagesDir,pagesDirs:s?._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:M,props:vt,revalidate:Q}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Jt(j),bt=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],tt=[...xt,...bt];if(tt.length>0){let C=pt(d,M,F||{}),O=ft(C,null,void 0,{isServer:!0}),E=await gt(tt,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 et=j.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(et)try{if(!await Function("route",`
44
+ </rss>`}async function zt(t={}){let i=Date.now();_t();let s=await o(process.cwd()),r=s.build||{},c=await ot({explicit:t.domain||r.domain,stxConfig:s});if(c.source==="fallback"&&(t.sitemap??r.sitemap??!0))console.warn(ct());let e={router:t.router??s?.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||s?.partialsDir||"",componentsDir:t.componentsDir||s?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},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-4szajb1z.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-k4wkfhvz.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 ht(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-4szajb1z.js");await u('<div class="bg-black"></div>')}catch{}lt();let yt=s?.routeMiddleware?.dir||"middleware";await dt(process.cwd(),yt);let H=ut();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let xt=s?.routeMiddleware?.global||[];Qo(s?.layoutsDir,a(process.cwd()));let K=L(".",{pagesDir:e.pagesDir,pagesDirs:s?._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:M,props:vt,revalidate:Q}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Jt(j),bt=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],tt=[...xt,...bt];if(tt.length>0){let C=pt(d,M,F||{}),O=ft(C,null,void 0,{isServer:!0}),E=await gt(tt,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 et=j.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(et)try{if(!await Function("route",`
45
45
  const validate = ${et[1]};
46
46
  return validate(route);
47
47
  `)({params:M})){console.warn(`Validation failed for ${d}, skipping...`);return}}catch{}let k=null,rt=!1;if(e.cache){if(k=B.get(d,v.filePath),k)rt=!0,l.cachedCount++}if(!k){let C=await wt(v,M,vt,e,s);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:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.606",
4
+ "version": "0.2.607",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -128,12 +128,12 @@
128
128
  "dependencies": {
129
129
  "@stacksjs/ts-css": "^0.3.11",
130
130
  "@stacksjs/clapp": "^0.2.16",
131
- "@stacksjs/desktop": "0.2.606",
132
- "@stacksjs/sanitizer": "0.2.606",
131
+ "@stacksjs/desktop": "0.2.607",
132
+ "@stacksjs/sanitizer": "0.2.607",
133
133
  "@stacksjs/ts-i18n": "^0.1.11",
134
- "bun-plugin-stx": "0.2.606",
134
+ "bun-plugin-stx": "0.2.607",
135
135
  "bunfig": "^0.15.21",
136
- "stx-router": "0.2.606",
136
+ "stx-router": "0.2.607",
137
137
  "ts-broadcasting": "^0.0.11",
138
138
  "ts-images": "^0.2.22",
139
139
  "ts-syntax-highlighter": "^0.2.1"
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{wu,xu}from"./chunk-9734nkc8.js";import"./chunk-y6gj9jq8.js";import"./chunk-vhajhs44.js";import"./chunk-s4pjf2pc.js";import"./chunk-r4wqh5fd.js";import"./chunk-dnqq1ze0.js";import"./chunk-wzjf33es.js";import"./chunk-6xsm53pz.js";import"./chunk-3cnwstra.js";import"./chunk-bhf9yt2w.js";import"./chunk-td5100fz.js";import"./chunk-x8q5przn.js";import"./chunk-06wv8qwy.js";import"./chunk-bsy8v1xj.js";import"./chunk-sswjv8p9.js";import"./chunk-azpkje69.js";import"./chunk-rmv35cx0.js";export{xu as clearStoreCache,wu as getStoreScript};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{es,Ql,eu}from"./chunk-htf3z9et.js";import"./chunk-y6gj9jq8.js";import"./chunk-vhajhs44.js";import"./chunk-s4pjf2pc.js";import"./chunk-r4wqh5fd.js";import"./chunk-dnqq1ze0.js";import"./chunk-wzjf33es.js";import"./chunk-6xsm53pz.js";import"./chunk-3cnwstra.js";import"./chunk-bhf9yt2w.js";import"./chunk-td5100fz.js";import"./chunk-x8q5przn.js";import"./chunk-06wv8qwy.js";import"./chunk-bsy8v1xj.js";import"./chunk-sswjv8p9.js";import"./chunk-azpkje69.js";import"./chunk-rmv35cx0.js";export{eu as clearComposableCache,Ql as getComposableScript,es as listComposableModules};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{la,ua}from"./chunk-4dfqgmgs.js";import"./chunk-vm2d4hap.js";import"./chunk-rg7wvcqw.js";import"./chunk-7095f0hb.js";import"./chunk-wy53pys4.js";import"./chunk-w67rrd1f.js";import"./chunk-kxjd6e2h.js";import"./chunk-mtxs4fya.js";import{Co}from"./chunk-vvfpb3k3.js";import"./chunk-vehtypx0.js";import"./chunk-td30jg06.js";import"./chunk-zs3tmd12.js";import"./chunk-r69jfs59.js";import"./chunk-m95zjk91.js";import"./chunk-mn7a5b55.js";import"./chunk-67tpacz0.js";import"./chunk-qh07a85k.js";import"./chunk-jsktg3ab.js";import"./chunk-t9t66sz4.js";import"./chunk-1jxdkp8x.js";import"./chunk-jpxekhdh.js";import"./chunk-efy3038a.js";import"./chunk-htf3z9et.js";import"./chunk-z8fhtym2.js";import"./chunk-vw62fjpv.js";import"./chunk-4tj0ap61.js";import"./chunk-m9h7pmkh.js";import"./chunk-mvwcf4xy.js";import"./chunk-9734nkc8.js";import"./chunk-xjxc4q3w.js";import"./chunk-fwp1en28.js";import"./chunk-9zwdpa7p.js";import"./chunk-yzj55rfs.js";import"./chunk-cfpenvc7.js";import"./chunk-y6gj9jq8.js";import"./chunk-vhajhs44.js";import"./chunk-s4pjf2pc.js";import{Se,yn,bn,J,u,n,pr,A,o,me}from"./chunk-r4wqh5fd.js";import"./chunk-dnqq1ze0.js";import"./chunk-wzjf33es.js";import"./chunk-6xsm53pz.js";import"./chunk-3cnwstra.js";import"./chunk-bhf9yt2w.js";import"./chunk-td5100fz.js";import"./chunk-x8q5przn.js";import"./chunk-06wv8qwy.js";import"./chunk-bsy8v1xj.js";import"./chunk-sswjv8p9.js";import"./chunk-azpkje69.js";import"./chunk-rmv35cx0.js";export{pr as buildWebComponents,bn as cacheTemplate,yn as checkCache,Co as classifyAllScripts,la as createMiddleware,ua as createRoute,A as defaultConfig,u as extractVariables,J as injectRouterScript,o as loadStxConfig,Se as processClientScript,n as processDirectives,me as readMarkdownFile};