@stacksjs/bun-router 0.1.7 → 0.1.8

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 (100) hide show
  1. package/dist/chunk-4wd1d6ay.js +416 -0
  2. package/dist/{chunk-nf3kv7kv.js → chunk-8rrs7556.js} +1 -1
  3. package/dist/{chunk-3y4gaz7v.js → chunk-m4aaj9ay.js} +1 -1
  4. package/dist/cli.js +30 -59
  5. package/dist/container/index.js +1 -1
  6. package/dist/index.js +2 -2
  7. package/package.json +9 -1
  8. package/dist/chunk-03m2j6h7.js +0 -2
  9. package/dist/chunk-08cw7ejr.js +0 -3
  10. package/dist/chunk-0e4g0fyv.js +0 -62
  11. package/dist/chunk-0mmn02yw.js +0 -2
  12. package/dist/chunk-126c9qm3.js +0 -2
  13. package/dist/chunk-12p13817.js +0 -2
  14. package/dist/chunk-14v65c37.js +0 -4
  15. package/dist/chunk-1b6a7t3v.js +0 -231
  16. package/dist/chunk-1wenkmk0.js +0 -2
  17. package/dist/chunk-2152npfd.js +0 -2
  18. package/dist/chunk-26w23krx.js +0 -2
  19. package/dist/chunk-2g8m379z.js +0 -10
  20. package/dist/chunk-2rr178et.js +0 -1654
  21. package/dist/chunk-2w8f3swz.js +0 -29
  22. package/dist/chunk-4r1x4afz.js +0 -12
  23. package/dist/chunk-4wyw66zk.js +0 -2
  24. package/dist/chunk-4z5sf8ag.js +0 -2
  25. package/dist/chunk-58tfvayh.js +0 -4
  26. package/dist/chunk-5be9x5cq.js +0 -3
  27. package/dist/chunk-5dp83qcx.js +0 -397
  28. package/dist/chunk-5f0d9j9a.js +0 -2
  29. package/dist/chunk-5z52b0fc.js +0 -28
  30. package/dist/chunk-5zrnk2kq.js +0 -4
  31. package/dist/chunk-6bbmkwng.js +0 -3
  32. package/dist/chunk-6dmqtdnq.js +0 -2
  33. package/dist/chunk-6e91956t.js +0 -3
  34. package/dist/chunk-6rv8w5jk.js +0 -2
  35. package/dist/chunk-6x1feysm.js +0 -3
  36. package/dist/chunk-7qnxdedn.js +0 -321
  37. package/dist/chunk-7y72hm1x.js +0 -2
  38. package/dist/chunk-8hbhfh6b.js +0 -194
  39. package/dist/chunk-8kfzygg5.js +0 -3
  40. package/dist/chunk-8wpj3fqe.js +0 -351
  41. package/dist/chunk-8wydx2we.js +0 -2
  42. package/dist/chunk-8zjnjvv7.js +0 -2
  43. package/dist/chunk-9805tt8n.js +0 -341
  44. package/dist/chunk-988h4bzr.js +0 -2
  45. package/dist/chunk-9b6a58ac.js +0 -2
  46. package/dist/chunk-a8fcaywb.js +0 -2
  47. package/dist/chunk-bfjwn7yg.js +0 -2
  48. package/dist/chunk-bp2522mm.js +0 -2
  49. package/dist/chunk-brpgjyqg.js +0 -3
  50. package/dist/chunk-bswe62q4.js +0 -48
  51. package/dist/chunk-c3v796c8.js +0 -943
  52. package/dist/chunk-ccqmwdry.js +0 -2
  53. package/dist/chunk-ck0crwnx.js +0 -2
  54. package/dist/chunk-cqgkxcb4.js +0 -2
  55. package/dist/chunk-dntnakjy.js +0 -2
  56. package/dist/chunk-dxg045wj.js +0 -5
  57. package/dist/chunk-e3qej0jr.js +0 -4
  58. package/dist/chunk-ettdpnrw.js +0 -60
  59. package/dist/chunk-ezqwq17j.js +0 -185
  60. package/dist/chunk-ezx3qsez.js +0 -2
  61. package/dist/chunk-f72nnjy4.js +0 -15413
  62. package/dist/chunk-fna5n0ey.js +0 -246
  63. package/dist/chunk-fqhckdt8.js +0 -2
  64. package/dist/chunk-fr6hbx25.js +0 -2
  65. package/dist/chunk-g9cwng6w.js +0 -3
  66. package/dist/chunk-gd3za5x0.js +0 -2
  67. package/dist/chunk-gf28608k.js +0 -2
  68. package/dist/chunk-h1dj6v8q.js +0 -3
  69. package/dist/chunk-hjxe7k2g.js +0 -2
  70. package/dist/chunk-hrkgznbn.js +0 -2
  71. package/dist/chunk-j6h5v0br.js +0 -2
  72. package/dist/chunk-kjtjbcq4.js +0 -71
  73. package/dist/chunk-mgb01qdv.js +0 -14
  74. package/dist/chunk-n24c9whp.js +0 -2
  75. package/dist/chunk-n2j24b0h.js +0 -4540
  76. package/dist/chunk-nhmtg01n.js +0 -84
  77. package/dist/chunk-p0qhpnqh.js +0 -70
  78. package/dist/chunk-p0w1x8y2.js +0 -3
  79. package/dist/chunk-p3dk1w2w.js +0 -216
  80. package/dist/chunk-q4e9pxs7.js +0 -3
  81. package/dist/chunk-q5dv1kyy.js +0 -2
  82. package/dist/chunk-qnqgf9tq.js +0 -2
  83. package/dist/chunk-qvwy1808.js +0 -898
  84. package/dist/chunk-r18f77vc.js +0 -12
  85. package/dist/chunk-r63za1mr.js +0 -2
  86. package/dist/chunk-rft8gw92.js +0 -7851
  87. package/dist/chunk-ryvmyskt.js +0 -4211
  88. package/dist/chunk-sa6mx308.js +0 -2
  89. package/dist/chunk-sw0chtw4.js +0 -4
  90. package/dist/chunk-va0pc7hx.js +0 -2
  91. package/dist/chunk-vcp8dnjq.js +0 -412
  92. package/dist/chunk-vg1erq1q.js +0 -2
  93. package/dist/chunk-vsh4390q.js +0 -358
  94. package/dist/chunk-w0jv49ch.js +0 -11
  95. package/dist/chunk-wm805tte.js +0 -35
  96. package/dist/chunk-xg9xscqz.js +0 -1
  97. package/dist/chunk-xj9h6mc9.js +0 -2
  98. package/dist/chunk-ytvzwrq3.js +0 -51
  99. package/dist/chunk-zde7ebc4.js +0 -288
  100. package/dist/chunk-zmqsv2xy.js +0 -2
@@ -1,4 +0,0 @@
1
- // @bun
2
- import{cf as g}from"./chunk-p0w1x8y2.js";function m(e,t){let r={};for(let n of e)r[n]=g(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,u)=>{if(r[a])r[a].set(u);else r[a]=g(u);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function D(e,t){let r={};for(let n of t)r[n]=e[n];return r}function p(e,t){let r=Object.keys(e),n=m(r,(s)=>t?.[s]??e[s].getDefaultValue()),a=m(r,()=>[]),u=m(r,()=>!1),d=m(r,()=>!1),f=m(r,()=>!1),i=g(!1);async function o(s){f[s]=!0;let c=await e[s].validate(n[s],n);return a[s]=c,f[s]=!1,c.length===0}async function l(){i.set(!0);let s=await Promise.all(r.map(o));return i.set(!1),s.every(Boolean)}function b(){for(let s of r)n[s]=t?.[s]??e[s].getDefaultValue(),a[s]=[],u[s]=!1,d[s]=!1}function y(s){for(let c of r)if(c in s)n[c]=s[c],d[c]=!0}function R(s,c){n[s]=c,d[s]=!0}function w(s,c=!0){if(u[s]=c,c)o(s)}function v(s){return{value:n[s],errors:a[s],touched:u[s],dirty:d[s],valid:a[s].length===0,validating:f[s]}}function S(s){return async(c)=>{c?.preventDefault?.();for(let M of r)u[M]=!0;if(await l())await s(D(n,r))}}return{values:n,errors:a,touched:u,dirty:d,get isValid(){return r.every((s)=>a[s].length===0)},get isValidating(){return i()||r.some((s)=>f[s])},get isDirty(){return r.some((s)=>d[s])},validate:l,validateField:o,reset:b,setValues:y,setFieldValue:R,setFieldTouched:w,getFieldState:v,handleSubmit:S}}var x=p;class h{rules=[];defaultValue="";addRule(e){let t=new h;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let u=String(a).length;return u>=e&&u<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let u=Number(a);return u>=e&&u<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new h;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,u)=>{if(!e(a,u||{}))return!0;return n.validate(a,u)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new h;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var O=new h;function N(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,u,d)=>{try{let f=u.trim().split("."),i=t;for(let l of f)if(i&&typeof i==="object"&&l in i)i=i[l];else return"";let o=i;if(!o||!Array.isArray(o)||o.length===0)return"";return o.map((l)=>d.replace(/\{\{\s*message\s*\}\}/g,l)).join(`
3
- `)}catch{return""}})}function V(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,u,d)=>{try{let f=u.trim().split("."),i=t;for(let l of f)if(i&&typeof i==="object"&&l in i)i=i[l];else return"";let o=i;if(!o||!Array.isArray(o)||o.length===0)return"";return o.map((l)=>d.replace(/\{\{\s*message\s*\}\}/g,l)).join(`
4
- `)}catch{return""}})}function A(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,u,d)=>{try{let f=u.trim().split("."),i=t;for(let l of f)if(i&&typeof i==="object"&&l in i)i=i[l];else return"";let o=i;if(!o||!Array.isArray(o)||o.length===0)return"";return d}catch{return""}})}function j(e,t,r){let n=e;return n=N(n,t,r),n=V(n,t,r),n=A(n,t,r),n}export{p as ne,x as oe,h as pe,O as qe,N as re,V as se,A as te,j as ue};
@@ -1,231 +0,0 @@
1
- // @bun
2
- import"./chunk-nf3kv7kv.js";var d=0;function u(){return`eb-${++d}-${Date.now().toString(36)}`}function p(e,o={},n){let r=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return e.replace(r,(t,a,l,s)=>{let i=u(),c=y(a||"");return b(i,l.trim(),s.trim(),c)})}function y(e){let o={},n=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,r;while((r=n.exec(e))!==null){let t=r[1],a=r[2]||r[3]||r[4];switch(t){case"id":o.id=a;break;case"logErrors":o.logErrors=a==="true";break}}return o}function b(e,o,n,r){let t=r.logErrors!==!1;return`
3
- <div class="stx-error-boundary" data-boundary-id="${e}" data-has-error="false">
4
- <div class="stx-error-boundary-content" data-boundary-content="${e}">
5
- ${o}
6
- </div>
7
- <div class="stx-error-boundary-fallback" data-boundary-fallback="${e}" style="display: none;">
8
- ${n}
9
- </div>
10
- </div>
11
- <script>
12
- (function() {
13
- const boundaryId = '${e}';
14
- const logErrors = ${t};
15
- const boundary = document.querySelector('[data-boundary-id="' + boundaryId + '"]');
16
- const contentEl = document.querySelector('[data-boundary-content="' + boundaryId + '"]');
17
- const fallbackEl = document.querySelector('[data-boundary-fallback="' + boundaryId + '"]');
18
-
19
- if (!boundary || !contentEl || !fallbackEl) return;
20
-
21
- // Error state
22
- let hasError = false;
23
- let lastError = null;
24
-
25
- // Show error fallback
26
- function showFallback(error) {
27
- hasError = true;
28
- lastError = error;
29
- boundary.setAttribute('data-has-error', 'true');
30
- contentEl.style.display = 'none';
31
- fallbackEl.style.display = '';
32
-
33
- if (logErrors) {
34
- console.error('[stx:errorBoundary:' + boundaryId + ']', error);
35
- }
36
-
37
- // Dispatch error event
38
- boundary.dispatchEvent(new CustomEvent('stx:error', {
39
- detail: { error: error, boundaryId: boundaryId },
40
- bubbles: true
41
- }));
42
- }
43
-
44
- // Retry function (resets the boundary)
45
- function retry() {
46
- hasError = false;
47
- lastError = null;
48
- boundary.setAttribute('data-has-error', 'false');
49
- contentEl.style.display = '';
50
- fallbackEl.style.display = 'none';
51
-
52
- // Dispatch retry event
53
- boundary.dispatchEvent(new CustomEvent('stx:retry', {
54
- detail: { boundaryId: boundaryId },
55
- bubbles: true
56
- }));
57
- }
58
-
59
- // Expose retry function
60
- window['$stxRetry_' + boundaryId.replace(/-/g, '_')] = retry;
61
-
62
- // Make $retry available within the fallback
63
- fallbackEl.querySelectorAll('[onclick*="$retry"]').forEach(function(el) {
64
- const onclick = el.getAttribute('onclick');
65
- if (onclick) {
66
- el.setAttribute('onclick', onclick.replace(/\\$retry\\(\\)/g, "window['$stxRetry_" + boundaryId.replace(/-/g, '_') + "']()"));
67
- }
68
- });
69
-
70
- // Handle @click="$retry()" syntax
71
- fallbackEl.querySelectorAll('[\\\\@click*="$retry"]').forEach(function(el) {
72
- el.addEventListener('click', function(e) {
73
- e.preventDefault();
74
- retry();
75
- });
76
- });
77
-
78
- // Also check for data-onclick
79
- fallbackEl.querySelectorAll('[data-onclick*="$retry"]').forEach(function(el) {
80
- el.addEventListener('click', function(e) {
81
- e.preventDefault();
82
- retry();
83
- });
84
- });
85
-
86
- // Catch errors in content
87
- contentEl.addEventListener('error', function(e) {
88
- showFallback(e.error || new Error('Unknown error'));
89
- }, true);
90
-
91
- // Wrap global error handler for this boundary
92
- const originalOnError = window.onerror;
93
- window.onerror = function(message, source, lineno, colno, error) {
94
- // Check if error originated from within this boundary
95
- if (contentEl.contains(document.activeElement) || isErrorFromBoundary(error)) {
96
- showFallback(error || new Error(String(message)));
97
- return true; // Prevent default handling
98
- }
99
- if (originalOnError) {
100
- return originalOnError.apply(this, arguments);
101
- }
102
- return false;
103
- };
104
-
105
- // Helper to check if error is from this boundary (basic heuristic)
106
- function isErrorFromBoundary(error) {
107
- if (!error || !error.stack) return false;
108
- return error.stack.includes(boundaryId);
109
- }
110
-
111
- // Expose error info
112
- window.STX = window.STX || {};
113
- window.STX.errorBoundaries = window.STX.errorBoundaries || {};
114
- window.STX.errorBoundaries[boundaryId] = {
115
- hasError: function() { return hasError; },
116
- getError: function() { return lastError; },
117
- retry: retry,
118
- showFallback: showFallback
119
- };
120
- })();
121
- </script>
122
- `}async function f(e,o,n){try{return await e()}catch(r){if(n)n(r instanceof Error?r:Error(String(r)));else console.error("[stx:errorBoundary] SSR Error:",r);return o}}function E(e,o={}){let n=o.onError?(r)=>o.onError(r,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(r)=>f(r,e,n)}function k(){return`
123
- /* STX Error Boundary Styles */
124
- .stx-error-boundary {
125
- position: relative;
126
- }
127
-
128
- .stx-error-boundary[data-has-error="true"] .stx-error-boundary-content {
129
- display: none;
130
- }
131
-
132
- .stx-error-boundary[data-has-error="true"] .stx-error-boundary-fallback {
133
- display: block !important;
134
- }
135
-
136
- /* Default fallback styling (can be overridden) */
137
- .stx-error-boundary-fallback {
138
- padding: 1rem;
139
- border: 1px solid #ef4444;
140
- border-radius: 0.5rem;
141
- background-color: #fef2f2;
142
- color: #991b1b;
143
- }
144
-
145
- .stx-error-boundary-fallback button {
146
- margin-top: 0.5rem;
147
- padding: 0.5rem 1rem;
148
- border: 1px solid #ef4444;
149
- border-radius: 0.25rem;
150
- background-color: #ef4444;
151
- color: white;
152
- cursor: pointer;
153
- }
154
-
155
- .stx-error-boundary-fallback button:hover {
156
- background-color: #dc2626;
157
- }
158
-
159
- /* Dark mode support */
160
- @media (prefers-color-scheme: dark) {
161
- .stx-error-boundary-fallback {
162
- background-color: #450a0a;
163
- color: #fecaca;
164
- }
165
- }
166
- `}function h(){return`
167
- // STX Error Boundary Runtime
168
- (function() {
169
- if (typeof window === 'undefined') return;
170
-
171
- window.STX = window.STX || {};
172
- window.STX.errorBoundaries = window.STX.errorBoundaries || {};
173
-
174
- // Create an error boundary programmatically
175
- window.STX.createErrorBoundary = function(element, options) {
176
- options = options || {};
177
- const boundaryId = 'eb-' + Date.now().toString(36) + '-' + Math.random().toString(36).slice(2);
178
-
179
- let hasError = false;
180
- let lastError = null;
181
- let fallbackContent = options.fallback || '<p>Something went wrong</p>';
182
-
183
- const contentWrapper = document.createElement('div');
184
- contentWrapper.className = 'stx-error-boundary-content';
185
-
186
- const fallbackWrapper = document.createElement('div');
187
- fallbackWrapper.className = 'stx-error-boundary-fallback';
188
- fallbackWrapper.style.display = 'none';
189
- fallbackWrapper.innerHTML = fallbackContent;
190
-
191
- // Move element's children to content wrapper
192
- while (element.firstChild) {
193
- contentWrapper.appendChild(element.firstChild);
194
- }
195
-
196
- element.appendChild(contentWrapper);
197
- element.appendChild(fallbackWrapper);
198
- element.classList.add('stx-error-boundary');
199
- element.setAttribute('data-boundary-id', boundaryId);
200
-
201
- function showFallback(error) {
202
- hasError = true;
203
- lastError = error;
204
- element.setAttribute('data-has-error', 'true');
205
- contentWrapper.style.display = 'none';
206
- fallbackWrapper.style.display = '';
207
- if (options.onError) options.onError(error);
208
- }
209
-
210
- function retry() {
211
- hasError = false;
212
- lastError = null;
213
- element.setAttribute('data-has-error', 'false');
214
- contentWrapper.style.display = '';
215
- fallbackWrapper.style.display = 'none';
216
- if (options.onRetry) options.onRetry();
217
- }
218
-
219
- window.STX.errorBoundaries[boundaryId] = {
220
- hasError: function() { return hasError; },
221
- getError: function() { return lastError; },
222
- retry: retry,
223
- showFallback: showFallback
224
- };
225
-
226
- return window.STX.errorBoundaries[boundaryId];
227
- };
228
-
229
- console.log('[stx] Error boundary runtime initialized');
230
- })();
231
- `}export{E as createErrorBoundary,k as generateErrorBoundaryCSS,h as generateErrorBoundaryRuntime,p as processErrorBoundaryDirectives,f as withErrorBoundary};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{m as a,n as b}from"./chunk-08cw7ejr.js";import"./chunk-h1dj6v8q.js";import"./chunk-fna5n0ey.js";import"./chunk-nf3kv7kv.js";export{b as createImageHandler,a as handleImageRequest};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Aj as a,Bj as b,Cj as c,Dj as d,Ej as e,Fj as f,Gj as g,Hj as h,Ij as i,Jj as j,Kj as k,Lj as l,Mj as m,Nj as n}from"./chunk-ryvmyskt.js";import"./chunk-2g8m379z.js";import"./chunk-ezqwq17j.js";import"./chunk-wm805tte.js";import"./chunk-58tfvayh.js";import"./chunk-brpgjyqg.js";import"./chunk-2rr178et.js";import"./chunk-5be9x5cq.js";import"./chunk-5zrnk2kq.js";import"./chunk-p0qhpnqh.js";import"./chunk-nf3kv7kv.js";export{l as applyFilters,e as clearCustomFilters,a as defaultFilters,f as escapeHtml,m as evaluateExpression,d as getAllFilters,i as interpolateScriptAttributes,h as interpolateScriptExpressions,j as interpolateScriptsInTemplate,k as processExpressions,b as registerFilter,c as registerFilters,n as unescapeHtml,g as usesSignalsInScript};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{rl as a,sl as b}from"./chunk-ryvmyskt.js";import"./chunk-2g8m379z.js";import"./chunk-ezqwq17j.js";import"./chunk-wm805tte.js";import"./chunk-58tfvayh.js";import"./chunk-brpgjyqg.js";import"./chunk-2rr178et.js";import"./chunk-5be9x5cq.js";import"./chunk-5zrnk2kq.js";import"./chunk-p0qhpnqh.js";import"./chunk-nf3kv7kv.js";export{a as parseLoopBinding,b as processLoops};
@@ -1,10 +0,0 @@
1
- // @bun
2
- import{jq as ne}from"./chunk-p0qhpnqh.js";import{Zu as te}from"./chunk-nf3kv7kv.js";import r from"path";function Y(s){return typeof s==="object"&&s!==null&&!Array.isArray(s)}function N(s,e){let t={...s};for(let[o,n]of Object.entries(e))t[o]=Y(n)&&Y(t[o])?N(t[o],n):n;return t}function q(s={},e={}){let t=s.theme||{},o=e.theme||{},{extend:n,...c}=o,{extend:i,...x}=t,f=N(x,c),S=N(i||{},n||{});if(Object.keys(S).length>0)f.extend=S;let B=[...s.safelist||[],...e.safelist||[]],k={...s.shortcuts||{},...e.shortcuts||{}},j=[...s.preflights||[],...e.preflights||[]];return{config:{...s,...e,theme:f,safelist:B,shortcuts:k,...j.length>0?{preflights:j}:{},content:[],output:""},safelist:B,shortcuts:k,includePreflight:e.preflight!==!1,minify:e.minify===!0}}import E from"path";var P=".stx",ce="STX_DIR",Z=null;function me(s){Z=s?.trim()||null}function F(){return process.env[ce]?.trim()||Z||P}function ee(s=process.cwd(),...e){let t=F();return E.isAbsolute(t)?E.join(t,...e):E.join(s,t,...e)}function Ce(s){if(!s||E.isAbsolute(s))return s;let e=s.replace(/\\/g,"/");if(e!==P&&!e.startsWith(`${P}/`))return s;let t=e.slice(P.length+1);return t?E.join(F(),t):F()}var a={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var p=null,G=!1,w=null,_="",b=!1,re=256,m=new Map,g=new Map,C=null,O=null;function M(s){return Bun.hash(s).toString(16).padStart(16,"0").slice(0,16)}function W(s,e){if(m.has(s))m.delete(s);else if(m.size>=re)m.delete(m.keys().next().value);m.set(s,e)}function ae(s){let e=M(s);if(g.has(e))g.delete(e);else if(g.size>=re)g.delete(g.keys().next().value);return g.set(e,s),e}function ve(s){let e=g.get(s);if(e===void 0)return;return g.delete(s),g.set(s,e),e}async function le(s){if(!C)return null;try{let e=Bun.file(r.join(C,`cw-${M(s)}.css`));if(!await e.exists())return null;return await e.text()}catch{return null}}async function de(s,e){if(!C)return;try{if(!fs.existsSync(C))fs.mkdirSync(C,{recursive:!0});await Bun.write(r.join(C,`cw-${M(s)}.css`),e)}catch{}}async function se(s){try{let e=await import(s);if(e&&e.CSSGenerator)return{CSSGenerator:e.CSSGenerator,config:e.config,build:e.build,defaultConfig:e.defaultConfig,extractClasses:e.extractClasses}}catch{}return null}function fe(){let s=[],e=process.cwd();while(e!==r.dirname(e))s.push(r.join(e,"node_modules","@cwcss","crosswind","dist","index.js")),s.push(r.join(e,"node_modules","@cwcss","crosswind","src","index.ts")),s.push(r.join(e,"pantry","@cwcss","crosswind","dist","index.js")),s.push(r.join(e,"pantry","@cwcss","crosswind","src","index.ts")),s.push(r.join(e,"node_modules","@stacksjs","crosswind","dist","index.js")),s.push(r.join(e,"pantry","@stacksjs","crosswind","dist","index.js")),e=r.dirname(e);return s}function ue(){let s=[],e=process.env.HOME||process.env.USERPROFILE||"";if(e){let t=[r.join(e,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),r.join(e,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),r.join(e,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),r.join(e,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),r.join(e,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),r.join(e,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];s.push(...t)}return s.push(r.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),s.push(r.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),s}async function oe(){if(G)return p;G=!0;try{let s=async(n)=>{for(let c of n){if(!await Bun.file(c).exists())continue;let i=await se(c);if(i){if(!process.env.STACKS_DEV_QUIET)console.log(`${a.green}[Crosswind]${a.reset} CSS engine loaded from ${r.dirname(r.dirname(c))}`);return i}}return null};if(process.env.CROSSWIND_SRC){let n=r.resolve(process.env.CROSSWIND_SRC),c=await s([n]);if(!c)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${n}`);return p=c,p}let e=await s(fe());if(e)return p=e,p;let t=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let n of t){let c=await se(n);if(c){if(p=c,!process.env.STACKS_DEV_QUIET)console.log(`${a.green}[Crosswind]${a.reset} CSS engine loaded`);return p}}let o=await s(ue());if(o)return p=o,p;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${a.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${a.reset}`),console.warn(`${a.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${a.reset}`),null}}function Te(){m.clear(),g.clear()}function De(){p=null,G=!1,w=null,_="",m.clear(),g.clear(),O=null}async function ie(s){try{if(!ne({name:"crosswind",cwd:s}))return null;let{loadConfigWithResult:e}=await import("./chunk-ccqmwdry.js"),t=await e({name:"crosswind",cwd:s,defaultConfig:{},checkEnv:!1,verbose:!1});if(!t?.path||!t.config||Object.keys(t.config).length===0)return null;let o=r.relative(s,t.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${a.green}[Crosswind]${a.reset} Loaded config from ${o||t.path}`);return t.config}catch(e){if(e instanceof Error&&e.name==="ConfigNotFoundError")return null;return console.warn(`${a.yellow}[Crosswind]${a.reset} Failed to load crosswind config:`,e instanceof Error?e.message:e),null}}async function ge(s){if(b)return _;b=!0;try{let e=await oe();if(!e||!e.build)return b=!1,"";if(!w)w=await ie(s);if(!w)return b=!1,"";let t=e.defaultConfig?.theme||{},o=w.theme||{},n={...e.defaultConfig,...w,theme:{...t,...o,extend:{...t.extend||{},...o.extend||{}}}},c=performance.now(),i=await e.build(n),x=performance.now()-c;if(_=i.css,console.log(`${a.cyan}[Crosswind]${a.reset} Built ${i.classes.size} classes in ${x.toFixed(1)}ms`),n.output){let f=r.isAbsolute(n.output)?n.output:r.join(s,n.output),S=r.dirname(f);if(!fs.existsSync(S))fs.mkdirSync(S,{recursive:!0});await Bun.write(f,i.css)}return b=!1,i.css}catch(e){return console.error(`${a.red}[Crosswind]${a.reset} Build error:`,e),b=!1,_}}async function Ee(s){w=null,await ge(s)}function _e(){return _}function we(s){let e=new Set,t=/class\s*=\s*["']([^"']+)["']/gi,o=t.exec(s);while(o!==null){for(let i of o[1].split(/\s+/))if(i.trim())e.add(i.trim());o=t.exec(s)}let n=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,c=n.exec(s);while(c!==null){let i=c[1].match(/'([^']+)'/g);if(i){for(let x of i)for(let f of x.slice(1,-1).split(/\s+/))if(f.trim())e.add(f.trim())}c=n.exec(s)}return e}async function pe(s,e){try{let t=await oe();if(!t)return"";let o=typeof t.extractClasses==="function"?t.extractClasses(s):we(s);if(o.size===0)return"";let n=e?r.resolve(e):process.cwd();if(!C)C=ee(n,"cache");let c=[...o].sort().join(" "),i=`${O||"default"}::${c}`,x=m.get(i);if(x!==void 0)return W(i,x),x;let f=await le(i);if(f!==null)return W(i,f),f;if(!w){let d=null;try{let{loadStxConfig:D}=await import("./chunk-bfjwn7yg.js"),l=await D(n);if(l.css)if(typeof l.css==="string"){let u=r.isAbsolute(l.css)?l.css:r.resolve(n,l.css);if(await Bun.file(u).exists()){let h=await import(u);d=h.default||h,console.log(`${a.green}[Crosswind]${a.reset} Loaded config from stx.config.ts \u2192 ${l.css}`)}}else{if(d={...l.css,content:l.css.content||[],preflight:l.css.preflight??!0,minify:l.css.minify??!1},l.css.config){let u=r.isAbsolute(l.css.config)?l.css.config:r.resolve(n,l.css.config);if(await Bun.file(u).exists()){let h=await import(u);d={...h.default||h,...d}}}console.log(`${a.green}[Crosswind]${a.reset} Using inline CSS config from stx.config.ts`)}}catch{}w=d||await ie(n);try{O=M(JSON.stringify(w??{}))}catch{O="unhashable"}}let S=t.defaultConfig||t.config,B=w||{},k=q(S,B),{safelist:j,includePreflight:K,minify:z}=k,U=k.config,v=new t.CSSGenerator(U);for(let d of j)v.generate(d);for(let d of o)v.generate(d);let y=v.toCSS(K,z),V=U.shortcuts||B.shortcuts||{};for(let[d,D]of Object.entries(V)){if(!o.has(d)&&!j.includes(d))continue;let l=D.split(/\s+/).filter(Boolean);for(let u of l)v.generate(u)}y=v.toCSS(K,z);let T=y.split(`
3
- `);for(let[d,D]of Object.entries(V)){if(!o.has(d)&&!j.includes(d))continue;let l=D.split(/\s+/).filter(Boolean),u=[],h=[];for(let I of l){let H=I.startsWith("dark:"),Q=`.${(H?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let R=0;R<T.length;R++){let X=T[R].trim();if(X===`${Q} {`||X.startsWith(`${Q} {`)){let A=R,J="";while(A<T.length){if(J+=T[A],T[A].includes("}"))break;A++}let L=J.match(/\{([^}]+)\}/);if(L)if(H)h.push(L[1].trim());else u.push(L[1].trim());break}}}if(u.length)y+=`
4
- .${d} { ${u.join(" ")} }`;if(h.length)y+=`
5
- @media (prefers-color-scheme: dark) { .dark .${d} { ${h.join(" ")} } }`}return W(i,y),de(i,y),y}catch(t){return console.warn("Failed to generate Crosswind CSS:",t),""}}async function Re(s,e,t=!1){let o=await pe(s,e);if(!o)return s;let n=t?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${ae(o)}.css">`:`<style data-crosswind="generated">
6
- ${o}
7
- </style>`,c=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(c.test(s)){let i=!1;return s.replace(c,()=>{if(i)return"";return i=!0,n})}if(s.includes("</head>"))return s.replace("</head>",`${n}
8
- </head>`);if(s.includes("<body"))return s.replace(/<body([^>]*)>/,`<body$1>
9
- ${n}`);return n+s}
10
- export{P as Rm,ce as Sm,me as Tm,F as Um,ee as Vm,Ce as Wm,N as Xm,q as Ym,a as Zm,ve as _m,oe as $m,Te as an,De as bn,ie as cn,ge as dn,Ee as en,_e as fn,we as gn,pe as hn,Re as in};