@stacksjs/stx 0.2.335 → 0.2.337
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.
- package/dist/build-views.js +1 -1
- package/dist/chunk-06qm6p8r.js +2 -0
- package/dist/{chunk-67bh5vrj.js → chunk-09xhvt5p.js} +1 -1
- package/dist/{chunk-te6qym2g.js → chunk-0dz59qg5.js} +2 -2
- package/dist/chunk-0e8x9jkb.js +2 -0
- package/dist/chunk-0tc5p1ty.js +2 -0
- package/dist/{chunk-vd5xvsnv.js → chunk-18018jkn.js} +1 -1
- package/dist/{chunk-5tefa8qb.js → chunk-1vb2rj09.js} +2 -2
- package/dist/chunk-1xqe92jv.js +2 -0
- package/dist/{chunk-c9wmv6n1.js → chunk-1ybanbh4.js} +10 -10
- package/dist/chunk-1ybaz0a1.js +2 -0
- package/dist/{chunk-fqq5k9ve.js → chunk-1z1efvtw.js} +1 -1
- package/dist/chunk-20e4pcq1.js +2 -0
- package/dist/chunk-2wn5db49.js +2 -0
- package/dist/chunk-3376d979.js +2 -0
- package/dist/{chunk-71y3bhcw.js → chunk-3405q9eb.js} +123 -37
- package/dist/chunk-3g2j4eh8.js +12 -0
- package/dist/{chunk-q85qp5we.js → chunk-3k4wcezp.js} +1 -1
- package/dist/{chunk-1ebyt1ba.js → chunk-3n9rvrk1.js} +1 -1
- package/dist/{chunk-m8kezfrt.js → chunk-3nv5h7jd.js} +5 -5
- package/dist/{chunk-zbtd1ceq.js → chunk-3ys2esa2.js} +1 -1
- package/dist/chunk-42tgak9b.js +2 -0
- package/dist/{chunk-0vv5s039.js → chunk-459qxwp1.js} +1 -1
- package/dist/chunk-45bmthfs.js +2 -0
- package/dist/chunk-4bcax4rv.js +2 -0
- package/dist/{chunk-t8ctvjqe.js → chunk-557n2zx7.js} +1 -1
- package/dist/{chunk-dvvx1wny.js → chunk-57atgbyq.js} +1 -1
- package/dist/{chunk-9kxfz708.js → chunk-58jwsgr1.js} +1 -1
- package/dist/{chunk-hyfjnn7g.js → chunk-5ep11kvc.js} +1 -1
- package/dist/chunk-5sqbd646.js +64 -0
- package/dist/chunk-623b1j9c.js +2 -0
- package/dist/{chunk-08w4gtyf.js → chunk-64kky38b.js} +3 -3
- package/dist/{chunk-2vgkc0kg.js → chunk-6ex0t14b.js} +1 -1
- package/dist/{chunk-y085rdre.js → chunk-6ym84983.js} +3 -3
- package/dist/{chunk-cr8v8k53.js → chunk-7r9vgzg4.js} +1 -1
- package/dist/{chunk-zsnrcbw1.js → chunk-7rf71ecp.js} +2 -2
- package/dist/{chunk-xwxdwqn9.js → chunk-7we3xfde.js} +1 -1
- package/dist/{chunk-xz3evxqp.js → chunk-8bxtvsgm.js} +1 -1
- package/dist/{chunk-e1sxe3q4.js → chunk-8wqz2s4j.js} +2 -2
- package/dist/chunk-96q01emr.js +2 -0
- package/dist/{chunk-9v0fsdsf.js → chunk-97yd8erh.js} +1 -1
- package/dist/{chunk-fkdnfjc2.js → chunk-994aga02.js} +2 -2
- package/dist/{chunk-kw98dfza.js → chunk-9btdax2s.js} +1 -1
- package/dist/{chunk-q0g5c39d.js → chunk-9kb0qv47.js} +1 -1
- package/dist/{chunk-9368t9jm.js → chunk-a959m68j.js} +1 -1
- package/dist/chunk-akdryjck.js +47 -0
- package/dist/{chunk-cdqx2c2h.js → chunk-apsmgvrk.js} +1 -1
- package/dist/{chunk-ymrxpwr8.js → chunk-as5j2s4h.js} +2 -2
- package/dist/chunk-at9knbt1.js +2 -0
- package/dist/chunk-b1w30x36.js +2 -0
- package/dist/{chunk-dghr3zxy.js → chunk-b9w95df7.js} +1 -1
- package/dist/chunk-bafd6h7t.js +16 -0
- package/dist/{chunk-ej8mv2k6.js → chunk-bgrkxzr7.js} +1 -1
- package/dist/{chunk-q05eh1n4.js → chunk-bkwg5cgq.js} +2 -2
- package/dist/chunk-btqmqzay.js +2 -0
- package/dist/chunk-bv65tr40.js +2 -0
- package/dist/chunk-c21x8w2q.js +2 -0
- package/dist/chunk-ch06z00p.js +2 -0
- package/dist/chunk-cs9w9kwy.js +2 -0
- package/dist/chunk-czh7agd6.js +2 -0
- package/dist/{chunk-kpeqn5tx.js → chunk-dfymexrx.js} +1 -1
- package/dist/{chunk-eth22r93.js → chunk-dwjcmxez.js} +1 -1
- package/dist/{chunk-t41aaehf.js → chunk-e4g8wz6t.js} +1 -1
- package/dist/{chunk-n66k2v2q.js → chunk-eeg62zy4.js} +2 -2
- package/dist/{chunk-mm59b0gg.js → chunk-er3adkx7.js} +1 -1
- package/dist/{chunk-pbexz0d4.js → chunk-evakht2n.js} +2 -2
- package/dist/chunk-evmc7vhg.js +2 -0
- package/dist/{chunk-pbzdjhp8.js → chunk-f5wernak.js} +1 -1
- package/dist/{chunk-4jdj52c5.js → chunk-f6sejeg3.js} +1 -1
- package/dist/{chunk-xdmb578h.js → chunk-fckan25d.js} +1 -1
- package/dist/{chunk-yxppshfd.js → chunk-g3cyygvf.js} +1 -1
- package/dist/{chunk-mwh3ymwc.js → chunk-g6czgcg4.js} +1 -1
- package/dist/chunk-gab2hnk7.js +2 -0
- package/dist/{chunk-5swem3qy.js → chunk-gwrrs1qh.js} +1 -1
- package/dist/chunk-gy9a83n9.js +4 -0
- package/dist/chunk-h3w1y4q7.js +2 -0
- package/dist/chunk-hphhqwn5.js +2 -0
- package/dist/{chunk-2cm03y4y.js → chunk-hv8j33px.js} +1 -1
- package/dist/{chunk-zz8qgqa1.js → chunk-j3b8cnss.js} +2 -2
- package/dist/{chunk-gptwwv3c.js → chunk-jc3t5y1y.js} +1 -1
- package/dist/{chunk-cdsbxghb.js → chunk-jkyvk4x6.js} +1 -1
- package/dist/chunk-jv70d481.js +2 -0
- package/dist/chunk-jxqf4y2y.js +2 -0
- package/dist/{chunk-4k0ce745.js → chunk-jyq43tp9.js} +2 -2
- package/dist/chunk-k14sz6cz.js +2 -0
- package/dist/chunk-m93qtfxw.js +2 -0
- package/dist/{chunk-dfejgnny.js → chunk-meqcxfpr.js} +1 -1
- package/dist/chunk-mppr5jht.js +2 -0
- package/dist/{chunk-7kw3grq5.js → chunk-nf7k53ap.js} +1 -1
- package/dist/{chunk-kffndzch.js → chunk-nzbdgx7d.js} +3 -3
- package/dist/chunk-p4bmz9x3.js +3 -0
- package/dist/{chunk-4ty8j3xn.js → chunk-peqad61h.js} +1 -1
- package/dist/chunk-pp2ssem6.js +2 -0
- package/dist/{chunk-nat3actx.js → chunk-psazw7p1.js} +1 -1
- package/dist/{chunk-vvd659y4.js → chunk-pt4xht7s.js} +1 -1
- package/dist/{chunk-drqdc0mh.js → chunk-qcf4506g.js} +1 -1
- package/dist/{chunk-q569zmrr.js → chunk-qnx0eb8x.js} +1 -1
- package/dist/{chunk-y4nzmkea.js → chunk-qsbjtp60.js} +1 -1
- package/dist/{chunk-c2ta859c.js → chunk-rb69qb49.js} +1 -1
- package/dist/{chunk-hzfd8cz0.js → chunk-s9hsxhb5.js} +2 -2
- package/dist/chunk-sfaj3res.js +2 -0
- package/dist/{chunk-64djh88a.js → chunk-sqvqwd0p.js} +1 -1
- package/dist/chunk-sy44sx1e.js +3747 -0
- package/dist/{chunk-wx5zf66r.js → chunk-t2h8prxq.js} +1 -1
- package/dist/{chunk-24b4711v.js → chunk-t77fg77q.js} +1 -1
- package/dist/chunk-tbynnx22.js +2 -0
- package/dist/{chunk-amxtypkp.js → chunk-tf3b833n.js} +1 -1
- package/dist/chunk-tgsj4g9k.js +2 -0
- package/dist/chunk-thfpfk45.js +2 -0
- package/dist/{chunk-deqnt1w5.js → chunk-tjhzxbxa.js} +1 -1
- package/dist/{chunk-2tjk867y.js → chunk-tp6wkx7g.js} +1 -1
- package/dist/{chunk-p1hy2bwn.js → chunk-v5d0xj8c.js} +3 -3
- package/dist/chunk-vcdt10ke.js +3 -0
- package/dist/{chunk-ya5m5vbn.js → chunk-vgfd9582.js} +1 -1
- package/dist/{chunk-42en0cxm.js → chunk-vjp1sg5y.js} +1 -1
- package/dist/{chunk-tjag2cmm.js → chunk-w3d5xrdy.js} +1 -1
- package/dist/{chunk-6k8h1fj1.js → chunk-w52p79xs.js} +1 -1
- package/dist/{chunk-yk6446kr.js → chunk-when7sgs.js} +2 -2
- package/dist/chunk-wj8sx4fx.js +2 -0
- package/dist/{chunk-crj19mqr.js → chunk-wmgpb6b6.js} +1 -1
- package/dist/{chunk-9fcq5x2r.js → chunk-wnnv5d1t.js} +1 -1
- package/dist/{chunk-27xfkzks.js → chunk-wv9v9mj9.js} +1 -1
- package/dist/{chunk-1hzgxk2m.js → chunk-wx3kf6tm.js} +1 -1
- package/dist/{chunk-1tva0f8f.js → chunk-wxpwt67g.js} +1 -1
- package/dist/{chunk-r8rbf28v.js → chunk-x5y9r3f2.js} +1 -1
- package/dist/{chunk-d4etph79.js → chunk-xgj1jw4p.js} +1 -1
- package/dist/{chunk-x7yc7e9v.js → chunk-xt7bsyj7.js} +1 -1
- package/dist/chunk-xzhvnk8r.js +2 -0
- package/dist/chunk-y97yx6ap.js +2 -0
- package/dist/{chunk-7r80apc5.js → chunk-yjkaqxtc.js} +1 -1
- package/dist/{chunk-09jdvqhg.js → chunk-yrj8gad9.js} +2 -2
- package/dist/{chunk-c79nfdyj.js → chunk-zk6ghjnj.js} +1 -1
- package/dist/{chunk-k6ky5et7.js → chunk-zp5z8qwy.js} +1 -1
- package/dist/{chunk-j2dj21ay.js → chunk-zyb5gfr0.js} +1 -1
- package/dist/cli.js +14 -14
- package/dist/component-contract-checks.d.ts +18 -15
- package/dist/component-contract.d.ts +6 -14
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/expressions.d.ts +45 -0
- package/dist/expressions.js +60 -11
- package/dist/includes.js +4 -0
- package/dist/loops.js +10 -0
- package/dist/pwa.js +2 -2
- package/dist/server-components.js +2 -1
- package/dist/signals.js +121 -35
- package/dist/slots.js +86 -12
- package/dist/ssg.js +2 -2
- package/dist/stx-virtual-ts.d.ts +205 -95
- package/dist/template-syntax-escape.d.ts +36 -0
- package/dist/template-syntax-escape.js +8 -0
- package/dist/utils.js +9 -2
- package/dist/visual-testing.js +1 -1
- package/package.json +8 -8
- package/dist/chunk-046dp691.js +0 -2
- package/dist/chunk-1brnvyhv.js +0 -2
- package/dist/chunk-207j85rm.js +0 -2
- package/dist/chunk-3ntf8f5e.js +0 -2
- package/dist/chunk-4tnxnzja.js +0 -2
- package/dist/chunk-63yfp05p.js +0 -2
- package/dist/chunk-7y4eqkv4.js +0 -2
- package/dist/chunk-7ywnkv1f.js +0 -2
- package/dist/chunk-80zj5516.js +0 -2
- package/dist/chunk-8730k51r.js +0 -2
- package/dist/chunk-907qxn09.js +0 -2
- package/dist/chunk-95e37e7c.js +0 -2
- package/dist/chunk-a97tp43x.js +0 -2
- package/dist/chunk-atw841yx.js +0 -2
- package/dist/chunk-c1m1gng4.js +0 -2
- package/dist/chunk-caaenc3w.js +0 -60
- package/dist/chunk-cbm6ar7z.js +0 -2
- package/dist/chunk-cvphepjb.js +0 -2
- package/dist/chunk-dnesmvvb.js +0 -2
- package/dist/chunk-ewsx2qxm.js +0 -2
- package/dist/chunk-farwrdr2.js +0 -3
- package/dist/chunk-fcenm8n1.js +0 -2
- package/dist/chunk-gbz6pfs8.js +0 -2
- package/dist/chunk-gdbkqatx.js +0 -43
- package/dist/chunk-jnahcd4d.js +0 -2
- package/dist/chunk-krpkfndf.js +0 -3
- package/dist/chunk-kxtqbrfr.js +0 -3759
- package/dist/chunk-m1yrakpk.js +0 -2
- package/dist/chunk-n9c975db.js +0 -2
- package/dist/chunk-q2hvne0v.js +0 -2
- package/dist/chunk-q86snkvs.js +0 -2
- package/dist/chunk-qpbk50xd.js +0 -2
- package/dist/chunk-rxdd3k6n.js +0 -2
- package/dist/chunk-ssd10kje.js +0 -2
- package/dist/chunk-szx6pxh3.js +0 -2
- package/dist/chunk-tpmgq2dx.js +0 -12
- package/dist/chunk-tte4m2s9.js +0 -2
- package/dist/chunk-vv289x82.js +0 -2
- package/dist/chunk-vx6mxybh.js +0 -2
- package/dist/chunk-wdvyn2va.js +0 -4
- package/dist/chunk-x510wr8z.js +0 -2
- package/dist/chunk-x95sxapm.js +0 -2
- package/dist/chunk-y1x2ebhv.js +0 -2
- package/dist/chunk-yzxm75jp.js +0 -2
package/dist/chunk-a97tp43x.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ri as a,Si as b,Ti as c}from"./chunk-4k0ce745.js";import"./chunk-xwxdwqn9.js";import"./chunk-kxtqbrfr.js";import"./chunk-caaenc3w.js";import"./chunk-amxtypkp.js";import"./chunk-nat3actx.js";import"./chunk-q0g5c39d.js";import"./chunk-kffndzch.js";import"./chunk-c2ta859c.js";import"./chunk-r8rbf28v.js";import"./chunk-gptwwv3c.js";import"./chunk-n66k2v2q.js";import"./chunk-vvd659y4.js";import"./chunk-7r80apc5.js";import"./chunk-2tjk867y.js";import"./chunk-t8ctvjqe.js";import"./chunk-deqnt1w5.js";import"./chunk-hzfd8cz0.js";import"./chunk-q569zmrr.js";import"./chunk-hyfjnn7g.js";export{a as listComposableModules,b as getComposableScript,c as clearComposableCache};
|
package/dist/chunk-atw841yx.js
DELETED
package/dist/chunk-c1m1gng4.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{$h as a,ai as b,bi as c,ci as d,di as e,ei as f,fi as g,gi as h}from"./chunk-5tefa8qb.js";import"./chunk-t41aaehf.js";import"./chunk-hyfjnn7g.js";export{d as v,a as useForm,g as processHasErrorsDirective,h as processFormValidationDirectives,f as processErrorsDirective,e as processErrorDirective,b as defineForm,c as Validator};
|
package/dist/chunk-caaenc3w.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{mt as bq}from"./chunk-amxtypkp.js";import{sw as k}from"./chunk-hyfjnn7g.js";var fq={1001:{message:"Unclosed directive: {{directive}}",help:"Make sure to close the directive with the appropriate end tag"},1002:{message:"Unclosed expression at position {{position}}",help:"Check for missing closing braces }}"},1003:{message:"Invalid directive syntax: {{directive}}",help:"Review the directive documentation for correct syntax"},1004:{message:"Malformed expression: {{expression}}",help:"Check for syntax errors in your expression"},1005:{message:"Unexpected token: {{token}}",help:"Remove or fix the unexpected token"},1101:{message:"Undefined variable: {{variable}}",help:"Make sure the variable is defined in the template context"},1102:{message:"Type error: {{details}}",help:"Check that you are using the correct types"},1103:{message:"Evaluation error: {{details}}",help:"Review the expression for errors"},1104:{message:"Infinite loop detected in {{location}}",help:"Check your loop conditions"},1105:{message:"Circular reference detected: {{path}}",help:"Remove the circular dependency"},1201:{message:"Unsafe expression blocked: {{expression}}",help:"This expression contains potentially dangerous code"},1202:{message:"Path traversal attempt blocked: {{path}}",help:"Use only relative paths within allowed directories"},1203:{message:"Potential XSS attempt blocked",help:"Sanitize user input before rendering"},1204:{message:"Code injection attempt blocked: {{code}}",help:"Avoid executing dynamic code"},1205:{message:"Prohibited DOM API usage: {{api}}",help:"Use STX.useRefs(), STX.useRef(), STX.el() and other STX helpers instead of direct DOM manipulation"},1301:{message:"File not found: {{path}}",help:"Check that the file exists and the path is correct"},1302:{message:"Error reading file: {{path}}",help:"Check file permissions and encoding"},1303:{message:"Invalid file path: {{path}}",help:"Use a valid file path"},1304:{message:"Permission denied: {{path}}",help:"Check file permissions"},1401:{message:"Invalid configuration: {{details}}",help:"Review your stx.config.ts file"},1402:{message:"Missing required configuration: {{key}}",help:"Add the required configuration option"},1403:{message:"Deprecated configuration: {{key}}",help:"Update to the new configuration format"},1501:{message:"Component not found: {{name}}",help:"Check that the component exists in your components directory"},1502:{message:"Invalid props for component {{name}}: {{details}}",help:"Check the component prop requirements"},1503:{message:"Error rendering component {{name}}: {{details}}",help:"Check the component template for errors"},1601:{message:"Filter not found: {{filter}}",help:"Register the filter or check the filter name"},1602:{message:"Invalid arguments for filter {{filter}}: {{details}}",help:"Check the filter documentation for correct arguments"},1603:{message:"Expression evaluation timed out",help:"Simplify the expression or increase the timeout"}},b={},$q="en";function hq(q){$q=q}function uq(){return $q}function dq(q){b={...b,...q}}function pq(){b={}}function Xq(q,Q={}){let J=b[q]||fq[q]||{message:`Unknown error (code: ${q})`},Z=J.message,$=J.help;for(let[Y,G]of Object.entries(Q)){let X=`{{${Y}}}`;if(Z=Z.replace(new RegExp(X,"g"),G),$)$=$.replace(new RegExp(X,"g"),G)}return{message:Z,help:$}}function mq(q,Q={}){let{message:J,help:Z}=Xq(q,Q);return Z?`${J}
|
|
3
|
-
Help: ${Z}`:J}var U={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function u(q){for(let[Q,J]of Object.entries(U))if(J===q)return Q;return}function cq(){return!1}function L(){return!cq()||process.env.STX_DEBUG==="true"}function GQ(){return!1}import lq from"path";var Yq={showRelativePaths:!1,enableAutoRecovery:L(),logRecoveryWarnings:!0},T={...Yq};function iq(q){T={...T,...q}}function E(){return{...T}}function sq(){T={...Yq}}function C(q){if(!T.showRelativePaths||!q)return q;let Q=T.baseDir||process.cwd();try{let J=lq.relative(Q,q);return J.startsWith("..")?q:J}catch{return q}}class N extends Error{code;filePath;line;column;context;numericCode;constructor(q,Q,J,Z,$,Y,G){super(q);this.code=Q;this.filePath=J;this.line=Z;this.column=$;this.context=Y;if(this.name="StxError",this.numericCode=G||U.EVALUATION_ERROR,this.filePath)this.filePath=C(this.filePath)}}class Hq extends N{constructor(q,Q,J,Z,$,Y){super(q,"stx_SYNTAX_ERROR",Q,J,Z,$,Y||U.INVALID_DIRECTIVE_SYNTAX);this.name="StxSyntaxError"}}class Gq extends N{constructor(q,Q,J,Z,$,Y){super(q,"stx_RUNTIME_ERROR",Q,J,Z,$,Y||U.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Wq extends N{constructor(q,Q,J,Z,$,Y){super(q,"stx_SECURITY_ERROR",Q,J,Z,$,Y||U.UNSAFE_EXPRESSION);this.name="StxSecurityError"}}class Bq extends N{constructor(q,Q,J,Z,$,Y){super(q,"stx_FILE_ERROR",Q,J,Z,$,Y||U.FILE_NOT_FOUND);this.name="StxFileError"}}class Vq extends N{isFatal=!0;constructor(q,Q,J,Z,$,Y){super(q,"stx_VALIDATION_ERROR",Q,J,Z,$,Y||U.DOM_API_VIOLATION);this.name="StxValidationError"}}function d(q){let{type:Q,message:J,code:Z,filePath:$,line:Y,column:G,template:X,offset:H,snippet:W,suggestion:B,format:V="text"}=q,w=Y,M=G;if(!w&&X&&H!==void 0){let I=Fq(X,H);w=I.line,M=I.column}let j=$?C($):void 0,D=Z?u(Z):void 0,K={type:Q,code:Z,codeName:D,message:J,filePath:j,line:w,column:M,snippet:W,suggestion:B,timestamp:new Date().toISOString()},F;switch(V){case"html":F=rq(K);break;case"json":F=JSON.stringify(K,null,2);break;case"console":F=oq(K,X,H);break;case"text":default:F=nq(K,X,H);break}return{formatted:F,data:K}}function nq(q,Q,J){let Z=[],$=q.code?` [${q.codeName||q.code}]`:"";if(Z.push(`[${q.type} Error${$}]`),q.filePath){let Y=q.filePath;if(q.line){if(Y+=`:${q.line}`,q.column)Y+=`:${q.column}`}Z.push(`at ${Y}`)}if(Z.push(`
|
|
4
|
-
${q.message}`),Q&&q.line){let Y=aq(Q,q.line,2);if(Y)Z.push(`
|
|
5
|
-
${Y}`)}if(q.snippet)Z.push(`
|
|
6
|
-
Snippet: ${q.snippet}`);if(q.suggestion)Z.push(`
|
|
7
|
-
Suggestion: ${q.suggestion}`);return Z.join(" ")}function rq(q){let Q=q.code?` [${q.code}]`:"",J=q.filePath?` in ${q.filePath}${q.line?`:${q.line}`:""}`:"",Z=`<!-- [${q.type} Error${Q}]${J}: ${wq(q.message)}`;if(q.suggestion)Z+=` | Suggestion: ${wq(q.suggestion)}`;return Z+=" -->",Z}function oq(q,Q,J){let W=[],B=q.code?` [${q.codeName||q.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${q.type} Error${B} \u2501\u2501\u2501${"\x1B[0m"}`),q.filePath){let V=`\x1B[36m${q.filePath}\x1B[0m`;if(q.line){if(V+=`\x1B[90m:${q.line}\x1B[0m`,q.column)V+=`\x1B[90m:${q.column}\x1B[0m`}W.push(`
|
|
8
|
-
\x1B[90mat\x1B[0m ${V}`)}if(W.push(`
|
|
9
|
-
|
|
10
|
-
${q.message}`),Q&&q.line){let V=tq(Q,q.line,2);if(V)W.push(`
|
|
11
|
-
|
|
12
|
-
\x1B[90mContext:\x1B[0m
|
|
13
|
-
${V}`)}if(q.suggestion)W.push(`
|
|
14
|
-
|
|
15
|
-
\x1B[33mSuggestion:\x1B[0m ${q.suggestion}`);return W.push(`
|
|
16
|
-
${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),W.join("")}function aq(q,Q,J){let Z=q.split(`
|
|
17
|
-
`),$=Math.max(0,Q-J-1),Y=Math.min(Z.length-1,Q+J-1),G=[];for(let X=$;X<=Y;X++){let H=(X+1).toString().padStart(4),W=X===Q-1?">":" ";G.push(`${W}${H} | ${Z[X]}`)}return G.join(`
|
|
18
|
-
`)}function tq(q,Q,J){let Z=q.split(`
|
|
19
|
-
`),$=Math.max(0,Q-J-1),Y=Math.min(Z.length-1,Q+J-1),G="\x1B[90m",X="\x1B[31m",H="\x1B[0m",W=[];for(let B=$;B<=Y;B++){let V=(B+1).toString().padStart(4),w=B===Q-1,M=w?"\x1B[31m>\x1B[0m":" ",j=w?`\x1B[31m${Z[B]}\x1B[0m`:`\x1B[90m${Z[B]}\x1B[0m`;W.push(`${M}\x1B[90m${V}\x1B[0m | ${j}`)}return W.join(`
|
|
20
|
-
`)}function wq(q){return q.replace(/--/g,"- -").replace(/>/g,">")}function Fq(q,Q){let Z=q.substring(0,Q).split(`
|
|
21
|
-
`);return{line:Z.length,column:Z[Z.length-1].length}}function y(q,Q,J){return d({type:q,message:Q,code:J,format:"html"}).formatted}function eq(q,Q,J,Z,$){return d({type:q,message:Q,code:$,filePath:J,line:Z,format:"console"}).formatted}function qJ(q,Q,J){let Z=J.template.split(`
|
|
22
|
-
`),$=Fq(J.template,J.offset),Y=`[${q} Error at line ${$.line} in ${J.filePath}]: ${Q}
|
|
23
|
-
|
|
24
|
-
`,G=Math.max(0,$.line-3),X=Math.min(Z.length-1,$.line+2);Y+=`Context:
|
|
25
|
-
`;for(let H=G;H<=X;H++){let W=H+1,B=Z[H]||"",V=H===$.line-1?">":" ";Y+=`${V} ${W.toString().padStart(3)}: ${B}
|
|
26
|
-
`}if($.line-1<Z.length){let H=" ".repeat($.column+5);Y+=`${H}^
|
|
27
|
-
`}return Y}function JJ(q,Q,J){try{return q()}catch(Z){if(J&&Z instanceof Error)J(Z);return Q}}async function QJ(q,Q,J){try{return await q()}catch(Z){if(J&&Z instanceof Error)J(Z);return Q}}var ZJ={isEnabled(){return E().enableAutoRecovery},fixCommonSyntaxErrors(q){let Q=E();if(!Q.enableAutoRecovery)return{fixed:q,fixes:[]};let J=q,Z=[],$=(J.match(/\{\{/g)||[]).length,Y=(J.match(/\}\}/g)||[]).length;if($>Y){let X=$-Y;J+="}}".repeat(X),Z.push(`Added ${X} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let X of G){let H=(J.match(new RegExp(`@${X}\\b`,"g"))||[]).length,W=(J.match(new RegExp(`@end${X}\\b`,"g"))||[]).length;if(H>W){let B=H-W;for(let V=0;V<B;V++)J+=`
|
|
28
|
-
@end${X}`;Z.push(`Added ${B} missing @end${X}`)}}if(Z.length>0&&Q.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Z.forEach((X)=>console.warn(` - ${X}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:J,fixes:Z}},createFallbackContent(q,Q){if(L())return`<!-- ${q} failed: ${Q.message} -->`;return"<!-- stx rendering error -->"}};class p{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(q={}){this.maxErrors=q.maxErrors??1000,this.enableFileLogging=q.enableFileLogging??!1,this.logFilePath=q.logFilePath??".stx/errors.log",this.logFormat=q.logFormat??"json",this.maxFileSize=q.maxFileSize??10485760,this.maxLogFiles=q.maxLogFiles??5,this.minLevel=q.minLevel??"all"}configure(q){if(q.maxErrors!==void 0)this.maxErrors=q.maxErrors;if(q.enableFileLogging!==void 0)this.enableFileLogging=q.enableFileLogging;if(q.logFilePath!==void 0)this.logFilePath=q.logFilePath;if(q.logFormat!==void 0)this.logFormat=q.logFormat;if(q.maxFileSize!==void 0)this.maxFileSize=q.maxFileSize;if(q.maxLogFiles!==void 0)this.maxLogFiles=q.maxLogFiles;if(q.minLevel!==void 0)this.minLevel=q.minLevel}log(q,Q,J="error"){let Z={timestamp:new Date,error:q,context:Q,level:J};if(this.errors.push(Z),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(J))this.writeToFile(Z)}shouldLog(q){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return q==="error"||q==="warning";if(this.minLevel==="error")return q==="error";return!0}formatEntry(q){if(this.logFormat==="json")return JSON.stringify({timestamp:q.timestamp.toISOString(),level:q.level||"error",type:q.error.constructor.name,message:q.error.message,stack:q.error.stack,context:q.context});let Q=[`[${q.timestamp.toISOString()}] [${(q.level||"error").toUpperCase()}] ${q.error.constructor.name}: ${q.error.message}`];if(q.error.stack)Q.push(` Stack: ${q.error.stack.split(`
|
|
29
|
-
`).slice(1).join(`
|
|
30
|
-
`)}`);if(q.context)Q.push(` Context: ${JSON.stringify(q.context)}`);return Q.join(`
|
|
31
|
-
`)}writeToFile(q){this.writeQueue=this.writeQueue.then(async()=>{try{let Q=await import("fs"),Z=(await import("path")).dirname(this.logFilePath);if(!Q.existsSync(Z))Q.mkdirSync(Z,{recursive:!0});await this.rotateIfNeeded(Q);let $=`${this.formatEntry(q)}
|
|
32
|
-
`;Q.appendFileSync(this.logFilePath,$,"utf-8")}catch(Q){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Q)}})}async rotateIfNeeded(q){try{if(!q.existsSync(this.logFilePath))return;if(q.statSync(this.logFilePath).size<this.maxFileSize)return;for(let J=this.maxLogFiles-1;J>=1;J--){let Z=`${this.logFilePath}.${J}`,$=`${this.logFilePath}.${J+1}`;if(q.existsSync(Z))if(J>=this.maxLogFiles-1)q.unlinkSync(Z);else q.renameSync(Z,$)}if(this.maxLogFiles<=1)q.writeFileSync(this.logFilePath,"");else q.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Q){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Q)}}getRecentErrors(q=10){return this.errors.slice(-q)}getErrorsByType(q){return this.errors.filter((Q)=>Q.error.constructor.name===q)}getErrorsByLevel(q){return this.errors.filter((Q)=>Q.level===q)}clear(){this.errors.length=0}async clearLogFile(){try{let q=await import("fs");if(q.existsSync(this.logFilePath))q.writeFileSync(this.logFilePath,"","utf-8")}catch(q){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",q)}}getStats(){let q={},Q={error:0,warning:0,info:0};for(let J of this.errors){let Z=J.error.constructor.name;q[Z]=(q[Z]||0)+1;let $=J.level||"error";Q[$]=(Q[$]||0)+1}return{total:this.errors.length,byType:q,byLevel:Q}}async exportToFile(q,Q="json"){let J=await import("fs"),$=(await import("path")).dirname(q);if(!J.existsSync($))J.mkdirSync($,{recursive:!0});if(Q==="json"){let Y=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));J.writeFileSync(q,JSON.stringify(Y,null,2),"utf-8")}else{let Y=this.errors.map((G)=>this.formatEntry(G));J.writeFileSync(q,Y.join(`
|
|
33
|
-
|
|
34
|
-
`),"utf-8")}}async flush(){await this.writeQueue}}var $J=new p,XJ={isDevelopment(){return L()},logDetailedError(q,Q){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",q.message),console.error("Stack:",q.stack),Q)console.error("Context:",Q);console.error("========================")},createErrorReport(q,Q){let J=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${q.message}`,`Type: ${q.constructor.name}`,`Stack: ${q.stack}`];if(Q)J.push(`Context: ${JSON.stringify(Q,null,2)}`);return J.push("========================"),J.join(`
|
|
35
|
-
`)}};import m from"path";var c={isValidFilePath(q,Q){let J=q.replace(/\\/g,"/");if(J.includes("\x00"))return!1;if(J.includes("../")||J.includes("..\\")||J===".."||J.startsWith("../")||J.endsWith("/..")||J.includes("/..\\")||J.includes("\\../"))return!1;if(/^[a-z][a-z0-9+.-]*:/i.test(J))return!1;if(J.startsWith("/")){if(["/etc/","/root/","/var/","/usr/","/bin/","/sbin/","/proc/","/sys/","/dev/","/boot/","/home/","/private/","/Library/","/System/"].some((Y)=>J===Y.slice(0,-1)||J.startsWith(Y)))return!1}if(/^[a-z]:/i.test(J)){if(["Windows/","Windows\\","System32/","System32\\","Program Files/","Program Files\\"].some((Y)=>J.includes(Y)))return!1}if(Q){let $=m.resolve(Q,q),Y=m.resolve(Q);if(!$.startsWith(Y+m.sep)&&$!==Y)return!1}return!0},isValidVariableName(q){return/^[a-z_$]\w*$/i.test(q)},isValidDirectiveName(q){return/^[a-z][\w-]*$/i.test(q)},isSafeContent(q){return![/<script[^>]*>[\s\S]*?<\/script>/i,/javascript:/i,/data:text\/html/i,/vbscript:/i,/on\w+\s*=/i].some((J)=>J.test(q))}};function YJ(q){let Q={"&":"&","<":"<",">":">",'"':""","'":"'"};return q.replace(/[&<>"']/g,(J)=>Q[J]||J)}function v(q,Q={}){let{allowHtml:J=!1,maxLength:Z=1e4,allowSpecialChars:$=!0,customSanitizer:Y}=Q,G=[],X=q,H=!1;if(Y){let B=Y(X);if(B!==X)X=B,H=!0}if(X.includes("\x00"))X=X.replace(/\0/g,""),H=!0,G.push("Null bytes removed from parameter");if(X.length>Z)X=X.substring(0,Z),H=!0,G.push(`Parameter truncated to ${Z} characters`);if(!J&&/<[^>]+>/.test(X))X=YJ(X),H=!0,G.push("HTML content was escaped");let W=[{pattern:/javascript:/gi,replacement:"",name:"javascript: URI"},{pattern:/vbscript:/gi,replacement:"",name:"vbscript: URI"},{pattern:/data:text\/html/gi,replacement:"",name:"data:text/html URI"}];for(let{pattern:B,replacement:V,name:w}of W)if(B.test(X))X=X.replace(B,V),H=!0,G.push(`Removed ${w} from parameter`);if(!$){let B=X;if(X=X.split("").filter((V)=>{let w=V.charCodeAt(0);return w>=32&&w!==127}).join(""),X!==B)H=!0,G.push("Control characters removed")}return{value:X,modified:H,warnings:G}}function HJ(q,Q){let J=q.replace(/\0/g,"");J=J.replace(/\\/g,"/"),J=J.replace(/^[a-z][a-z0-9+.-]*:/i,"");while(J.includes("../")||J.includes("./"))J=J.replace(/\.\.\//g,"").replace(/\.\//g,"");if(!c.isValidFilePath(J,Q))return null;return J}function GJ(q){let Q=[],J=q.trim(),Z=J!==q,$=[{pattern:/\beval\s*\(/gi,name:"eval()"},{pattern:/\bFunction\s*\(/gi,name:"Function()"},{pattern:/\bsetTimeout\s*\(/gi,name:"setTimeout()"},{pattern:/\bsetInterval\s*\(/gi,name:"setInterval()"},{pattern:/\bimport\s*\(/gi,name:"dynamic import()"},{pattern:/\brequire\s*\(/gi,name:"require()"},{pattern:/\b__proto__\b/gi,name:"__proto__"},{pattern:/\bconstructor\b/gi,name:"constructor"},{pattern:/\bprototype\b/gi,name:"prototype"}];for(let{pattern:Y,name:G}of $)if(Y.test(J))Q.push(`Potentially dangerous pattern detected: ${G}`);if(J.includes("\x00"))J=J.replace(/\0/g,""),Z=!0,Q.push("Null bytes removed from expression");return{value:J,modified:Z,warnings:Q}}function WJ(q,Q={}){return q.map((J)=>v(J,Q))}function Mq(q){let Q={};for(let[J,Z]of Object.entries(q)){if(!c.isValidVariableName(J))continue;if(typeof Z==="string"){let $=v(Z);Q[J]=$.value}else if(Array.isArray(Z))Q[J]=Z.map(($)=>typeof $==="string"?v($).value:$);else if(typeof Z==="object"&&Z!==null)Q[J]=Mq(Z);else Q[J]=Z}return Q}var BJ={maxSanitizeDepth:10,allowBracketNotation:!1},Uq={...BJ};var g=/\bnew\s+/,f="__stx_safe_ctors",_q=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,g,/\bdelete\s+/,/\bthis\b/],VJ=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",f]),Iq=new Set(["__proto__","constructor","prototype"]),wJ=/[\w)\]]\s*\[\s*['"]/;function Oq(q){let Q="",J=[],Z=null,$=!1;for(let Y=0;Y<q.length;Y++){let G=q[Y];if($){$=!1;continue}if(G==="\\"&&Z){$=!0;continue}if(Z){if(Z==="`"&&G==="$"&&Y+1<q.length&&q[Y+1]==="{"){let X=1;Y+=2;while(Y<q.length&&X>0){if(q[Y]==="{")X++;else if(q[Y]==="}")X--;if(X>0)Q+=q[Y],J.push(Y),Y++}continue}if(G===Z)Z=null;continue}if(G==='"'||G==="'"||G==="`"){Z=G;continue}Q+=G,J.push(Y)}return{text:Q,map:J}}function FJ(q){return Oq(q).text}var Aq=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],Nq=(()=>{let q={Date,URL,URLSearchParams},Q=Intl;for(let J of Aq)if(typeof Q[J]==="function")q[`Intl_${J}`]=Q[J];return Object.freeze(Object.assign(Object.create(null),q))})(),MJ=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,jq=/(?<![\w$])new(?![\w$])/g,Dq=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Aq.join(",")}}() are allowed`;function jJ(q){let{text:Q,map:J}=Oq(q),Z=[];jq.lastIndex=0;let $;while(($=jq.exec(Q))!==null){let G=$.index;if(/(?<!\.)\.\s*$/.test(Q.slice(0,G)))continue;let X=MJ.exec(Q.slice(G)),H=X?.[3],W=!X?null:H?`Intl_${H}`:X[2];if(!X||!W||!(W in Nq))throw new O(`matched /${g.source}/; ${Dq}`,q);let B=G+X[0].length,V=J[G],w=J[B-1]+1;if(q.slice(V,w)!==Q.slice(G,B))throw new O(`matched /${g.source}/; ${Dq}`,q);let M=V+3+X[1].length;Z.push({start:M,end:M+X[2].length,key:W})}let Y=q;for(let G=Z.length-1;G>=0;G--){let X=Z[G];Y=`${Y.slice(0,X.start)}${f}.${X.key}${Y.slice(X.end)}`}return{source:Y,usesSafeConstructors:Z.length>0}}class O extends Error{rule;expression;constructor(q,Q,J){super(J??`Potentially unsafe expression (${q}): ${Q}`);this.name="UnsafeExpressionError",this.rule=q,this.expression=Q}}function SQ(q){try{return i(q),null}catch(Q){return Q instanceof O?Q.rule:Q instanceof Error?Q.message:String(Q)}}function DJ(q,Q){let J=/[$A-Z_a-z][$\w]*/g,Z;while((Z=J.exec(q))!==null){let $=Z[0],Y=q[Z.index-1];if(VJ.has($))throw new O(`matched /\\b${$}\\b/; identifier ${$}`,Q);if(Y==="."&&Iq.has($))throw new O(`matched /.${$}/; property ${$}`,Q)}}function zJ(q){let Q=/\[\s*(['"])(.*?)\1\s*\]/g,J;while((J=Q.exec(q))!==null){let Z=J[2];if(!Iq.has(Z))continue;let $=q.slice(0,J.index).match(/\S(?=\s*$)/)?.[0],Y=q.slice(J.index+J[0].length).match(/^\s*(\S)/)?.[1];if(!(($==="{"||$===",")&&Y===":"))throw new O(`bracket key ${J[2]}`,q)}}function i(q){let Q=q.trim(),J=FJ(Q);DJ(J,Q),zJ(Q);for(let Z of _q){if(Z===g)continue;if(Z.test(J))throw new O(`matched /${Z.source}/`,Q)}if(!Uq.allowBracketNotation&&wJ.test(Q))throw new O("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",Q,`Bracket notation with strings not allowed: ${Q}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return jJ(Q)}function KJ(q){return i(q),q.trim()}function UJ(q){let Q={};Q.Math=Math,Q.JSON=JSON,Q.Date=Date,Q.String=String,Q.Number=Number,Q.Boolean=Boolean,Q.Array=Array,Q.parseInt=Number.parseInt,Q.parseFloat=Number.parseFloat,Q.isNaN=Number.isNaN,Q.isFinite=Number.isFinite,Q.encodeURIComponent=encodeURIComponent,Q.decodeURIComponent=decodeURIComponent;for(let[J,Z]of Object.entries(q)){if(J.startsWith("__")||_q.some(($)=>$.test(J)))continue;if(Z&&typeof Z==="object"&&!Array.isArray(Z))Q[J]=l(Z);else Q[J]=Z}return Q}function l(q,Q=0){if(Q>=Uq.maxSanitizeDepth)return"[Object too deep]";if(q===null||typeof q!=="object")return q;if(Array.isArray(q))return q.map((Z)=>l(Z,Q+1));if(q instanceof Date||q instanceof RegExp||q instanceof Map||q instanceof Set||q instanceof Error)return q;let J={};for(let[Z,$]of Object.entries(q)){if(Z.startsWith("__")||Z==="constructor"||Z==="prototype")continue;if($&&typeof $==="object")J[Z]=l($,Q+1);else J[Z]=$}return J}function _J(q,Q){try{let J=UJ(Q),Z=Object.keys(J),$=Object.values(J);return NJ(q,Z)(...$)}catch{return}}function bQ(q){try{return KJ(q),!0}catch{return!1}}function s(q,Q){try{let J=_J(q,Q);if(J&&typeof J==="object"&&!Array.isArray(J))return J;return{}}catch{return{}}}var kq=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),IJ=2000,x=new Map;function zq(q,Q){let J=`${q.join(",")}\x00${Q}`,Z=x.get(J);if(Z)return Z;let $=Function(...q,Q);if(x.size>=IJ)x.clear();return x.set(J,$),$}function EQ(q){return q.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var OJ=/^[A-Za-z_$][\w$]*$/;function AJ(q){return OJ.test(q)&&!kq.has(q)}function NJ(q,Q){let{source:J,usesSafeConstructors:Z}=i(q),$=[];for(let W=0;W<Q.length;W++){if(!AJ(Q[W]))continue;if(Q[W]===f)continue;$.push({key:Q[W],index:W})}$.sort((W,B)=>W.key.localeCompare(B.key));let Y=$.map((W)=>W.key),G=$.map((W)=>W.index),X=`
|
|
36
|
-
'use strict';
|
|
37
|
-
try {
|
|
38
|
-
return ${J};
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
if (e instanceof TypeError) {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
throw e;
|
|
45
|
-
}
|
|
46
|
-
`;return kJ(Z?(W)=>{let B=zq([f,...Y,...W],X);return(...V)=>B(Nq,...V)}:(W)=>zq([...Y,...W],X),Y,Q,$,G)}function kJ(q,Q,J,Z,$){let Y=q([]),G=Z.every((H,W)=>H.index===W);if(Q.length===J.length&&G)return Kq(Y,Q,q);return Kq((...H)=>{let W=Array($.length);for(let B=0;B<$.length;B++)W[B]=H[$[B]];return Y(...W)},Q,q,(H)=>{Y=q(H)})}function Kq(q,Q,J,Z){let Y=/^(\w+) is not defined$/,G=q,X=[],H=new Set(Q);return(...W)=>{for(let B=0;B<=8;B++)try{return G(...W)}catch(V){let w=V instanceof Error?V.message:"",M=Y.exec(w);if(!(V instanceof ReferenceError)||!M)return;let j=M[1];if(H.has(j)||kq.has(j))return;if(H.add(j),X.push(j),Z)Z(X);else G=J(X)}return}}function CQ(q){let Q=q.trim(),J=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Z of J)if(Z.test(Q))return!1;return!0}import r from"path";var P;async function TJ(){if(P!==void 0)return P;try{P=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{P=null}return P}var t={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},z={},_={},A={};function fQ(q){if(q)delete z[q];else for(let Q of Object.keys(z))delete z[Q]}function hQ(){let q=Object.entries(z).map(([Q,J])=>({locale:Q,loadedAt:new Date(J.loadedAt),keyCount:Lq(J.translations)}));return{size:Object.keys(z).length,locales:Object.keys(z),entries:q}}function Lq(q,Q=0){for(let J of Object.values(q))if(Q++,J&&typeof J==="object"&&!Array.isArray(J))Q=Lq(J,Q);return Q}function RJ(q,Q=0){if(Q<=0)return!1;return Date.now()-q.loadedAt>Q}function uQ(q){if(z[q])return"loaded";return A[q]||"idle"}function dQ(q){return A[q]==="loading"}function pQ(q){return!!z[q]}async function LJ(q,Q){let{locales:J,parallel:Z=!0,priority:$={},onLocaleLoaded:Y,onComplete:G,onError:X}=q,H=Z?J:[...J].sort((W,B)=>($[B]||0)-($[W]||0));if(Z){let W=H.map(async(B)=>{try{await h(B,Q),Y?.(B)}catch(V){X?.(B,V instanceof Error?V:Error(String(V)))}});await Promise.all(W)}else for(let W of H)try{await h(W,Q),Y?.(W)}catch(B){X?.(W,B instanceof Error?B:Error(String(B)))}G?.()}function mQ(q,Q){queueMicrotask(()=>{LJ(q,Q).catch((J)=>{if(Q.debug)console.error("Background preload error:",J)})})}async function h(q,Q){if({...t,...Q.i18n}.cache&&z[q]){let $=z[q],Y=Q.i18n?.cacheMaxAge??0;if(!RJ($,Y))return $.translations}if(_[q]?.state==="loading")return _[q].promise;A[q]="loading";let Z=o(q,Q).then(($)=>{return A[q]="loaded",delete _[q],$}).catch(($)=>{throw A[q]="error",_[q]={promise:Z,state:"error",error:$ instanceof Error?$:Error(String($))},$});return _[q]={promise:Z,state:"loading"},Z}function PJ(q){return z[q]?.translations}async function cQ(q,Q){let J=PJ(q);if(J)return J;return h(q,Q)}async function lQ(q,Q){if(z[q])return z[q].translations;if(_[q]){if(Q)return Promise.race([_[q].promise,new Promise((J,Z)=>setTimeout(()=>Z(Error(`Timeout waiting for locale: ${q}`)),Q))]);return _[q].promise}throw Error(`Locale "${q}" is not loading. Call loadTranslationLazy first.`)}function iQ(){return Object.entries(A).filter(([q,Q])=>Q==="loading").map(([q])=>q)}function sQ(q){if(q)delete _[q],delete A[q];else{for(let Q of Object.keys(_))delete _[Q];for(let Q of Object.keys(A))delete A[Q]}}async function o(q,Q){let J={...t,...Q.i18n},Z=r.isAbsolute(J.translationsDir)?J.translationsDir:r.resolve(Q.root||process.cwd(),J.translationsDir);try{let $=await TJ(),Y=$?await $(q,{translationsDir:Z,defaultLocale:J.defaultLocale,sources:yJ(J.format)}):await SJ(q,J,Z);if(Y===void 0){if(q!==J.defaultLocale)return o(J.defaultLocale,Q);return{}}let G=Y;if(J.cache)z[q]={translations:G,loadedAt:Date.now(),locale:q};return G}catch($){if(Q.debug)console.error(`Error loading translation file for locale "${q}":`,$);if(q!==J.defaultLocale)return o(J.defaultLocale,Q);return{}}}async function SJ(q,Q,J){let Z=r.join(J,`${q}${bJ(Q.format)}`);try{let $=await import(Z);return $.default||$}catch($){try{let Y=await Bun.file(Z).text();if(Q.format==="yaml"||Q.format==="yml")return EJ(Y);if(Q.format==="json")return JSON.parse(Y);throw $}catch{return}}}function bJ(q){switch(q){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function EJ(q){let Q={},J=q.split(`
|
|
47
|
-
`),Z=[{obj:Q,indent:-1}];for(let $ of J){let Y=$.replace(/#.*$/,"").trimEnd();if(!Y.trim())continue;let G=Y.search(/\S/);if(G===-1)continue;while(Z.length>1&&Z[Z.length-1].indent>=G)Z.pop();let X=Z[Z.length-1].obj,H=Y.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(H){let[,,W,B]=H,V=W.trim(),w=B.trim();if(w==="")X[V]={},Z.push({obj:X[V],indent:G});else X[V]=CJ(w)}}return Q}function CJ(q){if(q.startsWith("'")&&q.endsWith("'")||q.startsWith('"')&&q.endsWith('"'))return q.slice(1,-1);let Q=q.toLowerCase();if(Q==="true"||Q==="yes")return!0;if(Q==="false"||Q==="no")return!1;if(Q==="null"||Q==="~")return null;let J=Number(q);if(!Number.isNaN(J)&&q!=="")return J;return q}function yJ(q){switch(q){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function vJ(q,Q){return h(q,Q)}function xJ(q,Q){for(let J of q){let Z=J.trim(),$=Z.match(/^\{(\d+)\}\s*(.*)$/);if($){let G=Number.parseInt($[1],10);if(Q===G)return $[2];continue}let Y=Z.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Y){let G=Number.parseInt(Y[1],10),X=Y[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Y[2],10);if(Q>=G&&Q<=X)return Y[3];continue}}if(q.length===2)return Q===1?q[0].trim():q[1].trim();if(Q<q.length)return q[Q].trim();return q[q.length-1].trim()}function gJ(q,Q={}){return Pq(q,Q)}function Pq(q,Q){let J="",Z=0;while(Z<q.length)if(q[Z]==="{"){let $=fJ(q,Z);if($===-1){J+=q[Z],Z++;continue}let Y=q.slice(Z+1,$);J+=hJ(Y,Q),Z=$+1}else if(q[Z]==="'"&&Z+1<q.length)if(q[Z+1]==="'")J+="'",Z+=2;else if(q[Z+1]==="{"||q[Z+1]==="}")J+=q[Z+1],Z+=2;else J+=q[Z],Z++;else J+=q[Z],Z++;return J}function fJ(q,Q){let J=0;for(let Z=Q;Z<q.length;Z++)if(q[Z]==="{")J++;else if(q[Z]==="}"){if(J--,J===0)return Z}return-1}function hJ(q,Q){let J=uJ(q);if(J.length===0)return`{${q}}`;let Z=J[0].trim(),$=Q[Z];if(J.length===1)return $!==void 0?String($):`{${Z}}`;switch(J[1].trim().toLowerCase()){case"plural":return dJ($,J.slice(2).join(","),Q);case"select":return mJ($,J.slice(2).join(","));case"selectordinal":return cJ($,J.slice(2).join(","));case"number":return iJ($,J[2]?.trim());case"date":return sJ($,J[2]?.trim());case"time":return nJ($,J[2]?.trim());default:return $!==void 0?String($):`{${q}}`}}function uJ(q){let Q=[],J="",Z=0;for(let $=0;$<q.length;$++){let Y=q[$];if(Y==="{")Z++,J+=Y;else if(Y==="}")Z--,J+=Y;else if(Y===","&&Z===0)Q.push(J),J="";else J+=Y}if(J)Q.push(J);return Q}function dJ(q,Q,J){let Z=Number(q)||0,$=e(Q),Y=`=${Z}`;if($[Y])return n($[Y],Z,J);let G=pJ(Z);if($[G])return n($[G],Z,J);if($.other)return n($.other,Z,J);return String(Z)}function n(q,Q,J){let Z=q.replace(/#/g,String(Q));return Pq(Z,J)}function pJ(q){let Q=Math.abs(q),J=Math.floor(Q),Z=String(q).includes(".")?String(q).split(".")[1].length:0;if(J===1&&Z===0)return"one";return"other"}function mJ(q,Q){let J=String(q||""),Z=e(Q);if(Z[J])return Z[J];return Z.other||String(q)}function cJ(q,Q){let J=Number(q)||0,Z=e(Q),$=lJ(J);if(Z[$])return Z[$].replace(/#/g,String(J));if(Z.other)return Z.other.replace(/#/g,String(J));return String(J)}function lJ(q){let Q=Math.abs(q),J=Q%10,Z=Q%100;if(J===1&&Z!==11)return"one";if(J===2&&Z!==12)return"two";if(J===3&&Z!==13)return"few";return"other"}function e(q){let Q={},J=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Z=J.exec(q);while(Z!==null)Q[Z[1]]=Z[2],Z=J.exec(q);return Q}function iJ(q,Q){let J=Number(q);if(Number.isNaN(J))return String(q);switch(Q){case"integer":return Math.floor(J).toLocaleString();case"percent":return`${(J*100).toFixed(0)}%`;case"currency":return J.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return J.toLocaleString()}}function sJ(q,Q){let J=q instanceof Date?q:new Date(String(q));if(Number.isNaN(J.getTime()))return String(q);let Z={};switch(Q){case"short":Z.dateStyle="short";break;case"medium":Z.dateStyle="medium";break;case"long":Z.dateStyle="long";break;case"full":Z.dateStyle="full";break;default:Z.dateStyle="medium"}return J.toLocaleDateString(void 0,Z)}function nJ(q,Q){let J=q instanceof Date?q:new Date(String(q));if(Number.isNaN(J.getTime()))return String(q);let Z={};switch(Q){case"short":Z.timeStyle="short";break;case"medium":Z.timeStyle="medium";break;case"long":Z.timeStyle="long";break;case"full":Z.timeStyle="full";break;default:Z.timeStyle="short"}return J.toLocaleTimeString(void 0,Z)}function rJ(q){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(q)}function a(q,Q,J=!0,Z={}){let $=q.split("."),Y=Q;for(let X of $){if(Y===void 0||Y===null)break;Y=Y[X]}if(Y===void 0||Y===null)return J?q:"";let G=String(Y);if(rJ(G))return gJ(G,Z);if(G.includes("|")&&"count"in Z){let X=Number(Z.count),H=G.split("|");G=xJ(H,X)}for(let[X,H]of Object.entries(Z)){let W=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(H))}return G}var Tq=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),oJ=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function qq(q){if(!q)return"ltr";let Q=q.trim().toLowerCase().replace(/_/g,"-").split("-"),J=Q[0];if(!J)return"ltr";let Z=Q[1]?.length===4?Q[1]:void 0;if(Z)return oJ.has(Z)?"rtl":"ltr";if(Q.length>1&&Tq.has(`${J}-${Q[1]}`))return"rtl";return Tq.has(J)?"rtl":"ltr"}function nQ(q){return qq(q)==="rtl"}async function rQ(q,Q,J,Z){let $=q,Y=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...t,...Z.i18n},X=await vJ(G.locale,Z);Q.__translations=X,Q.__locale=G.locale,Q.__i18nConfig=G,$=await Rq($,Y,async(B,V,w,M,j)=>{try{let D={};if(w)try{let F=[()=>JSON.parse(w),()=>{let I=`{"data":${w}}`,R=JSON.parse(I);return typeof R.data==="object"?R.data:{}},()=>{return s(w,Q)}];for(let I of F)try{if(D=I(),Object.keys(D).length>0)break}catch{}}catch(F){if(Z.debug)console.error("Error parsing parameters for @translate directive:",F)}return a(V,X,G.fallbackToKey,D)||M.trim()}catch(D){if(Z.debug)console.error("Error processing @translate directive:",D);return y("Translate",`Error in @translate('${V}'): ${D instanceof Error?D.message:String(D)}`,U.EVALUATION_ERROR)}});let H=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Z.debug){console.warn(`Processing translations in template. Sections: ${$.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let B=[...$.matchAll(H)];console.warn(`Found ${B.length} @translate matches`),B.forEach((V,w)=>console.warn(`Match ${w}: ${V[0]}, Key: ${V[1]}, Params: ${V[2]||"none"}`))}return $=await Rq($,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(B,V,w,M)=>{try{let j={};if(w)try{let D=[()=>JSON.parse(w),()=>{let K=`{"data":${w}}`,F=JSON.parse(K);return typeof F.data==="object"?F.data:{}},()=>{return s(w,Q)}];for(let K of D)try{if(j=K(),Object.keys(j).length>0)break}catch{}}catch(D){if(Z.debug)console.error("Error parsing parameters for @translate directive:",D)}return a(V,X,G.fallbackToKey,j)}catch(j){if(Z.debug)console.error("Error processing @translate directive:",j);return y("Translate",`Error in @translate('${V}'): ${j instanceof Error?j.message:String(j)}`,U.EVALUATION_ERROR)}}),$}async function Rq(q,Q,J){let Z=[];return q.replace(Q,(Y,...G)=>{let X=J(Y,...G).then((H)=>({match:Y,replacement:H}));return Z.push(X),Y}),(await Promise.all(Z)).reduce((Y,{match:G,replacement:X})=>Y.replace(G,X),q)}function oQ(q,Q=!0){return(J,Z={})=>{return a(J,q,Q,Z)}}import Sq from"path";function Jq(q,Q){if(!q||qq(q)!=="rtl")return!1;return!Q||Q.trim().toLowerCase()!=="rtl"}function Eq(q){if(!q)return!1;return q.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||q.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function S(q,Q){let J=new RegExp(`\\b${Q}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(q);if(!J)return null;return J[2]??J[3]??J[4]??null}function JZ(q,Q,J,Z){let $=q;$=$.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,X,H)=>{let B={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[X]||"Make this element accessible";return`<!-- a11y-hint: ${H||B} -->`});let Y=/@screenReader\(([^@]*)\)@endScreenReader/g;return $=$.replace(Y,(G,X)=>{return`<span class="sr-only">${X.trim()}</span>`}),$=$.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,X,H)=>{return`<span id="${`desc-${X}`}" class="sr-only">${H}</span>`}),$}function QZ(){return`
|
|
48
|
-
.sr-only {
|
|
49
|
-
position: absolute;
|
|
50
|
-
width: 1px;
|
|
51
|
-
height: 1px;
|
|
52
|
-
padding: 0;
|
|
53
|
-
margin: -1px;
|
|
54
|
-
overflow: hidden;
|
|
55
|
-
clip: rect(0, 0, 0, 0);
|
|
56
|
-
white-space: nowrap;
|
|
57
|
-
border-width: 0;
|
|
58
|
-
}
|
|
59
|
-
`.trim()}function aJ(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function Cq(q){let Q=new Map,J=q.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,($,Y,G)=>{let X=Q.get(G);if(!X)X=`stx-a11y-component-${Q.size}`,Q.set(G,X);return`<${Y}${X}`}),Z=new Map([...Q.entries()].map(([$,Y])=>[Y,$]));return{protectedSource:J,restore:($)=>$.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(Y,G,X)=>{let H=Z.get(X);return H?`<${G}${H}`:Y})}}function tJ(q,Q){let J=[],Z=/<img\s+([^>]*)>/gi,$;$=Z.exec(q);while($!==null){let F=$[1];if(!/\balt\s*=/i.test(F))J.push({type:"missing-alt",element:$[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});$=Z.exec(q)}let Y=/<button([^>]*)>\s*<\/button>/gi;$=Y.exec(q);while($!==null){let F=$[1];if(!/\baria-label\s*=/i.test(F)&&!/\btitle\s*=/i.test(F))J.push({type:"missing-accessible-name",element:$[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});$=Y.exec(q)}let G=/<a\s+([^>]*)>\s*<\/a>/gi;$=G.exec(q);while($!==null){let F=$[1];if(!/\baria-label\s*=/i.test(F)&&!/\btitle\s*=/i.test(F))J.push({type:"link-missing-text",element:$[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});$=G.exec(q)}let X=/<(input|select|textarea)\s+([^>]*)>/gi;$=X.exec(q);while($!==null){let F=$[2];if(/\btype\s*=\s*["']hidden["']/i.test(F)){$=X.exec(q);continue}let I=/\baria-label\s*=/i.test(F)||/\baria-labelledby\s*=/i.test(F),R=F.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!I){let yq=R&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${R[1]}["']`,"i").test(q),Qq=$.index,Zq=q.substring(0,Qq),YQ=q.substring(Qq),vq=(Zq.match(/<label\b/gi)||[]).length,xq=(Zq.match(/<\/label>/gi)||[]).length,gq=vq>xq;if(!yq&&!gq)J.push({type:"input-missing-label",element:$[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}$=X.exec(q)}let H=/<h([1-6])[^>]*>/gi,W=[];$=H.exec(q);while($!==null)W.push(Number.parseInt($[1],10)),$=H.exec(q);let B=0;for(let F of W){if(B>0&&F>B+1)J.push({type:"heading-skip",element:`<h${F}>`,message:`Heading level skipped from h${B} to h${F}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});B=F}if(/<html\b/i.test(q)&&!/<html[^>]*\slang\s*=/i.test(q))J.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let V=q.match(/<html\b([^>]*)>/i);if(V&&Jq(S(V[1],"lang"),S(V[1],"dir")))J.push({type:"missing-dir",element:V[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let w=/<table([^>]*)>([\s\S]*?)<\/table>/gi;$=w.exec(q);while($!==null){let F=$[2];if(!Eq(S($[1],"role"))&&!/<th\b/i.test(F))J.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});$=w.exec(q)}let M=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;$=M.exec(q);while($!==null){if(!/\bmuted\b/i.test($[0]))J.push({type:"autoplay-audio",element:`<${$[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});$=M.exec(q)}let j=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;$=j.exec(q);while($!==null)J.push({type:"positive-tabindex",element:`tabindex="${$[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),$=j.exec(q);let D=/<iframe\s+([^>]*)>/gi;$=D.exec(q);while($!==null){let F=$[1];if(!/\btitle\s*=/i.test(F)&&!/\baria-label\s*=/i.test(F))J.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});$=D.exec(q)}let K=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;$=K.exec(q);while($!==null){let F=$[1].toLowerCase(),I=$[2];if(F!=="button"&&!/\btabindex\s*=/i.test(I))J.push({type:"button-not-focusable",element:$[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});$=K.exec(q)}return J}async function eJ(q,Q){let{protectedSource:J}=Cq(q);if(!aJ())return tJ(J,Q);let Z=[];try{let $=globalThis.document.createElement("div");$.innerHTML=J,$.querySelectorAll("img").forEach((H)=>{if(!H.hasAttribute("alt"))Z.push({type:"missing-alt",element:`<${H.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),$.querySelectorAll('button, a, [role="button"]').forEach((H)=>{if(!(H.hasAttribute("aria-label")||H.hasAttribute("aria-labelledby")||H.textContent&&H.textContent.trim().length>0))Z.push({type:"missing-accessible-name",element:`<${H.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),$.querySelectorAll("input, select, textarea").forEach((H)=>{let W=H.getAttribute("id"),B=W&&$.querySelector(`label[for="${W}"]`),V=H.hasAttribute("aria-label")||H.hasAttribute("aria-labelledby"),w=H.closest("label")!==null;if(!B&&!V&&!w)Z.push({type:"input-missing-label",element:`<${H.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let Y=Array.from($.querySelectorAll("h1, h2, h3, h4, h5, h6")),G=0;for(let H of Y){let W=Number.parseInt(H.tagName.charAt(1));if(G>0&&W>G+1)Z.push({type:"heading-skip",element:`<${H.outerHTML}>`,message:`Heading level skipped from h${G} to h${W}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});G=W}let X=$.querySelector("html");if(J.includes("<html")&&X&&!X.hasAttribute("lang"))Z.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(X&&Jq(X.getAttribute("lang"),X.getAttribute("dir")))Z.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if($.querySelectorAll("a").forEach((H)=>{let W=H.textContent&&H.textContent.trim().length>0,B=H.hasAttribute("aria-label")||H.hasAttribute("aria-labelledby"),V=H.hasAttribute("title"),w=H.querySelector("img[alt]");if(!W&&!B&&!V&&!w)Z.push({type:"link-missing-text",element:`<${H.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),J.includes("<nav")||J.includes("<header")){if(!$.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&$.querySelectorAll("a").length>5)Z.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if($.querySelectorAll("table").forEach((H)=>{if(Eq(H.getAttribute("role")))return;let W=H.querySelector("caption");if(!H.querySelector("th"))Z.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!W&&!H.hasAttribute("aria-label")&&!H.hasAttribute("aria-labelledby"))Z.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),$.querySelectorAll('[style*="color"]').forEach((H)=>{let W=H.getAttribute("style")||"";if(W.includes("color:")&&!W.includes("background"))Z.push({type:"potential-contrast-issue",element:`<${H.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),$.querySelectorAll("video[autoplay], audio[autoplay]").forEach((H)=>{if(!H.hasAttribute("muted"))Z.push({type:"autoplay-audio",element:`<${H.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),$.querySelectorAll("[tabindex]").forEach((H)=>{if(Number.parseInt(H.getAttribute("tabindex")||"0")>0)Z.push({type:"positive-tabindex",element:`<${H.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),$.querySelectorAll('[role="button"]').forEach((H)=>{if(!H.hasAttribute("tabindex"))Z.push({type:"button-not-focusable",element:`<${H.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),J.includes("<body")&&!$.querySelector('main, [role="main"]'))Z.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});$.querySelectorAll("iframe").forEach((H)=>{if(!H.hasAttribute("title")&&!H.hasAttribute("aria-label"))Z.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch($){console.error(`Error checking accessibility in ${Q}:`,$)}return Z}async function qQ(q,Q={}){let J={},{recursive:Z=!0,ignorePaths:$=[]}=Q,Y=Array.isArray(q)?q:[q],G=await bq(Y,{recursive:Z,ignorePaths:$}),X=[];for(let H of G)try{let W=await Bun.file(H).text();if(H.endsWith("good-a11y.stx"))continue;let B=await eJ(W,H);if(X.push(H),B.length>0)J[H]=B}catch(W){console.error(`Error scanning ${H}:`,W)}return{results:J,scannedFiles:X}}async function ZZ(q,Q={}){return(await qQ(q,Q)).results}var JQ={fixMissingAlt:!0,fixMissingLabels:!0,fixMissingFormLabels:!0,fixTableHeaders:!0,fixMissingLang:!0,fixMissingDir:!0,fixPositiveTabindex:!0,fixButtonFocusable:!0,defaultLang:"en"};function QQ(q,Q={}){let J={...JQ,...Q},Z=[],{protectedSource:$,restore:Y}=Cq(q),G=$;if(J.fixMissingAlt)G=G.replace(/<img([^>]*?)(?<!\balt\s*=\s*["'][^"']*["'])(\s*\/?>)/gi,(X,H,W)=>{if(/\balt\s*=/i.test(H))return X;let B=X,V=`<img${H} alt=""${W}`;return Z.push({type:"missing-alt",description:"Added empty alt attribute to image",before:B,after:V}),V});if(J.fixMissingLabels)G=G.replace(/<button([^>]*)>\s*<\/button>/gi,(X,H)=>{if(/\baria-label\s*=/i.test(H)||/\btitle\s*=/i.test(H))return X;let W=X,B=`<button${H} aria-label="Button"></button>`;return Z.push({type:"missing-accessible-name",description:"Added aria-label to empty button",before:W,after:B}),B}),G=G.replace(/<a([^>]*)>\s*(<(?:i|span|svg)[^>]*(?:class="[^"]*icon[^"]*")?[^>]*>.*?<\/(?:i|span|svg)>)?\s*<\/a>/gi,(X,H,W)=>{if(/\baria-label\s*=/i.test(H)||/\btitle\s*=/i.test(H))return X;if(!W&&X.replace(/<a[^>]*>|<\/a>/gi,"").trim())return X;let B=X,V=`<a${H} aria-label="Link">${W||""}</a>`;return Z.push({type:"missing-accessible-name",description:"Added aria-label to link without text",before:B,after:V}),V});if(J.fixMissingFormLabels)G=G.replace(/<(input|select|textarea)([^>]*)>/gi,(X,H,W)=>{if(/\baria-label\s*=/i.test(W)||/\baria-labelledby\s*=/i.test(W))return X;if(/\btype\s*=\s*["']hidden["']/i.test(W))return X;let B=W.match(/\bname\s*=\s*["']([^"']+)["']/i),V=W.match(/\bid\s*=\s*["']([^"']+)["']/i),w=B?.[1]||V?.[1]||H,M=X,j=`<${H}${W} aria-label="${w}">`;return Z.push({type:"input-missing-label",description:`Added aria-label to ${H} element`,before:M,after:j}),j});if(J.fixMissingLang)G=G.replace(/<html([^>]*)>/gi,(X,H)=>{if(/\blang\s*=/i.test(H))return X;let W=X,B=`<html${H} lang="${J.defaultLang}">`;return Z.push({type:"missing-lang",description:`Added lang="${J.defaultLang}" to html element`,before:W,after:B}),B});if(J.fixMissingDir)G=G.replace(/<html([^>]*)>/gi,(X,H)=>{let W=S(H,"lang");if(!Jq(W,S(H,"dir")))return X;let B=/\bdir\s*=/i.test(H)?`<html${H.replace(/\bdir\s*=\s*(["'])[^"']*\1/i,'dir="rtl"')}>`:`<html${H} dir="rtl">`;return Z.push({type:"missing-dir",description:`Added dir="rtl" to html element (lang="${W}" is right-to-left)`,before:X,after:B}),B});if(J.fixPositiveTabindex)G=G.replace(/\btabindex\s*=\s*["']([1-9]\d*)["']/gi,(X,H)=>{let W=X,B='tabindex="0"';return Z.push({type:"positive-tabindex",description:`Changed tabindex="${H}" to tabindex="0"`,before:W,after:'tabindex="0"'}),'tabindex="0"'});if(J.fixButtonFocusable)G=G.replace(/<([a-z]+)(\s[^>]*role\s*=\s*["']button["'][^>]*)>/gi,(X,H,W)=>{if(/\btabindex\s*=/i.test(W))return X;if(H.toLowerCase()==="button")return X;let B=X,V=`<${H}${W} tabindex="0">`;return Z.push({type:"button-not-focusable",description:'Added tabindex="0" to element with role="button"',before:B,after:V}),V});if(J.fixTableHeaders)G=G.replace(/<th([^>]*)>/gi,(X,H)=>{if(/\bscope\s*=/i.test(H))return X;let W=X,B=`<th${H} scope="col">`;return Z.push({type:"table-missing-scope",description:'Added scope="col" to table header',before:W,after:B}),B});return{original:q,fixed:Y(G),fixCount:Z.length,fixes:Z}}async function ZQ(q,Q={},J=!1){let Z=await Bun.file(q).text(),$=QQ(Z,Q);if(J&&$.fixCount>0)await Bun.write(q,$.fixed);return $}async function $Z(q,Q={},J={}){let Z={},{recursive:$=!0,ignorePaths:Y=[],writeBack:G=!1,extensions:X=[".stx",".html",".htm"]}=J,H=X.length===1?`*${X[0]}`:`*{${X.join(",")}}`,W=Sq.join(q,$?`**/${H}`:H),B=new Bun.Glob(W);for await(let V of B.scan()){if(Y.some((M)=>V.includes(Sq.normalize(M))))continue;try{let M=await ZQ(V,Q,G);if(M.fixCount>0)Z[V]=M}catch(M){console.error(`Error fixing ${V}:`,M)}}return Z}var $Q={name:"a11y",handler:(q,Q,J,Z)=>{if(!Q.length)return q;let $=Q[0].replace(/['"]/g,""),Y=Q.length>1?Q[1].replace(/['"]/g,""):"",X={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[$]||"Make this element accessible";return`<!-- a11y-hint: ${Y||X} -->${q}`},hasEndTag:!1},XQ={name:"screenReader",handler:(q)=>{return`<span class="sr-only">${q}</span>`},hasEndTag:!0};function XZ(){return[$Q,XQ]}
|
|
60
|
-
export{hq as Kr,uq as Lr,dq as Mr,pq as Nr,Xq as Or,mq as Pr,U as Qr,u as Rr,cq as Sr,L as Tr,GQ as Ur,iq as Vr,E as Wr,sq as Xr,C as Yr,N as Zr,Hq as _r,Gq as $r,Wq as as,Bq as bs,Vq as cs,d as ds,y as es,eq as fs,qJ as gs,JJ as hs,QJ as is,ZJ as js,p as ks,$J as ls,XJ as ms,c as ns,v as os,HJ as ps,GJ as qs,WJ as rs,Mq as ss,SQ as ts,KJ as us,_J as vs,bQ as ws,s as xs,EQ as ys,AJ as zs,NJ as As,CQ as Bs,t as Cs,fQ as Ds,hQ as Es,uQ as Fs,dQ as Gs,pQ as Hs,LJ as Is,mQ as Js,h as Ks,PJ as Ls,cQ as Ms,lQ as Ns,iQ as Os,sQ as Ps,vJ as Qs,gJ as Rs,rJ as Ss,a as Ts,qq as Us,nQ as Vs,rQ as Ws,oQ as Xs,Eq as Ys,S as Zs,JZ as _s,QZ as $s,aJ as at,tJ as bt,eJ as ct,qQ as dt,ZZ as et,QQ as ft,ZQ as gt,$Z as ht,$Q as it,XQ as jt,XZ as kt};
|
package/dist/chunk-cbm6ar7z.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ye as a}from"./chunk-zbtd1ceq.js";import"./chunk-y085rdre.js";import"./chunk-dvvx1wny.js";import"./chunk-p1hy2bwn.js";import"./chunk-kxtqbrfr.js";import"./chunk-caaenc3w.js";import"./chunk-amxtypkp.js";import"./chunk-nat3actx.js";import"./chunk-q0g5c39d.js";import"./chunk-kffndzch.js";import"./chunk-c2ta859c.js";import"./chunk-r8rbf28v.js";import"./chunk-gptwwv3c.js";import"./chunk-n66k2v2q.js";import"./chunk-vvd659y4.js";import"./chunk-7r80apc5.js";import"./chunk-2tjk867y.js";import"./chunk-t8ctvjqe.js";import"./chunk-deqnt1w5.js";import"./chunk-hzfd8cz0.js";import"./chunk-q569zmrr.js";import"./chunk-hyfjnn7g.js";export{a as startProductionServer};
|
package/dist/chunk-cvphepjb.js
DELETED
package/dist/chunk-dnesmvvb.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Po as a,Qo as b,Ro as c,So as d,To as e,Uo as f,Vo as g,Wo as h,Xo as i,Yo as j}from"./chunk-kxtqbrfr.js";import"./chunk-caaenc3w.js";import"./chunk-amxtypkp.js";import"./chunk-nat3actx.js";import"./chunk-q0g5c39d.js";import"./chunk-kffndzch.js";import"./chunk-c2ta859c.js";import"./chunk-r8rbf28v.js";import"./chunk-gptwwv3c.js";import"./chunk-n66k2v2q.js";import"./chunk-vvd659y4.js";import"./chunk-7r80apc5.js";import"./chunk-2tjk867y.js";import"./chunk-t8ctvjqe.js";import"./chunk-deqnt1w5.js";import"./chunk-hzfd8cz0.js";import"./chunk-q569zmrr.js";import"./chunk-hyfjnn7g.js";export{b as stripTypeScript,h as splitDeclaration,c as isModuleResolutionFailure,d as isMissingBindingFailure,f as isCompleteImport,j as hasVariables,e as extractVariables,i as extractScriptFromTemplate,g as convertToCommonJS,a as STX_ENGINE_BINDING_NAMES};
|
package/dist/chunk-ewsx2qxm.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{ap as a,bp as b,cp as c,dp as d,ep as e,fp as f,gp as g}from"./chunk-kxtqbrfr.js";import"./chunk-caaenc3w.js";import"./chunk-amxtypkp.js";import"./chunk-nat3actx.js";import"./chunk-q0g5c39d.js";import"./chunk-kffndzch.js";import"./chunk-c2ta859c.js";import"./chunk-r8rbf28v.js";import"./chunk-gptwwv3c.js";import"./chunk-n66k2v2q.js";import"./chunk-vvd659y4.js";import"./chunk-7r80apc5.js";import"./chunk-2tjk867y.js";import"./chunk-t8ctvjqe.js";import"./chunk-deqnt1w5.js";import"./chunk-hzfd8cz0.js";import"./chunk-q569zmrr.js";import"./chunk-hyfjnn7g.js";export{a as resetUnscopedSignalWarnings,g as processStackReplacements,f as processStackPushDirectives,e as processIncludes,b as partialsCache,c as onceStore,d as clearOnceStore};
|
package/dist/chunk-farwrdr2.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Fm as I}from"./chunk-kxtqbrfr.js";import{As as V,ws as F}from"./chunk-caaenc3w.js";function R(j,W){let U=1,z=W,G="<template",X="</template";while(z<j.length&&U>0){let J=j.indexOf("<",z);if(J===-1)break;if(z=J,j.startsWith(G,z)&&(z+G.length>=j.length||/[\s>\/]/.test(j[z+G.length]))){U++,z+=G.length;continue}if(j.startsWith(X,z)){let Y=j.indexOf(">",z+X.length);if(Y!==-1){if(U--,U===0)return Y+1;z=Y+1;continue}}z++}return U===0?z:-1}var P=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function D(j,W){let U=null;for(let z=W;z<j.length;z++){let G=j[z];if(U){if(G==="\\"){z++;continue}if(G===U)U=null;continue}if(G==='"'||G==="'"){U=G;continue}if(G===">")return z+1}return-1}function b(j){let W=[],U=[],z=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,G=0;while(G<j.length){let X=j.indexOf("<",G);if(X===-1)break;if(j.startsWith("<!--",X)){let $=j.indexOf("-->",X+4);G=$===-1?j.length:$+3;continue}let J=D(j,X+1);if(J===-1)break;let Y=j.slice(X,J),Q=Y.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!Q){G=J;continue}let Z=Q[1]==="/",H=Q[2].toLowerCase();if(Z){let $=U.lastIndexOf(H);if($!==-1)U.splice($);G=J;continue}if(H==="template"&&U.length===0){let $=Y.match(z);if($){let K=R(j,J);if(K!==-1){let O=$[1]||$[2]||$[3];W.push({start:X,end:K,slotName:O,content:j.slice(J,K-11).trim(),propsBinding:$[4]||void 0}),G=K;continue}}}if(!/\/\s*>$/.test(Y)&&!P.has(H)){if(U.push(H),H==="script"||H==="style"){let $=j.toLowerCase().indexOf(`</${H}>`,J);if($!==-1){G=$;continue}}}G=J}return W}function w(j){let W={default:"",named:new Map},U=j,z=b(j);for(let Q of z)W.named.set(Q.slotName,{name:Q.slotName,content:Q.content,propsBinding:Q.propsBinding});z.sort((Q,Z)=>Z.start-Q.start);for(let Q of z)U=U.slice(0,Q.start)+U.slice(Q.end);let G=[],X=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,J;while((J=X.exec(U))!==null){let[Q,Z,H,_,$,K]=J,O=H.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=$.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(O+B).trim(),q=`<${Z}${L?" "+L:""}>${K}</${Z}>`;G.push({start:J.index,end:J.index+Q.length,slotName:_,element:q})}let Y=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((J=Y.exec(U))!==null){let[Q,Z,H,_,$]=J,K=H.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=$.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=(K+O).trim(),L=`<${Z}${B?" "+B:""} />`;G.push({start:J.index,end:J.index+Q.length,slotName:_,element:L})}G.sort((Q,Z)=>Z.start-Q.start);for(let Q of G){let Z=W.named.get(Q.slotName);if(Z)Z.content+=Q.element;else W.named.set(Q.slotName,{name:Q.slotName,content:Q.element});U=U.slice(0,Q.start)+U.slice(Q.end)}return W.default=U.trim(),W}function C(j){let W=j.match(/name\s*=\s*["']([^"']+)["']/),U=W?W[1]:"",z={},G=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,X;while((X=G.exec(j))!==null)z[X[1]]=X[2];let J=j.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),Y=J?J[1].trim():"";return{name:U,props:z,defaultContent:Y}}async function N(j,W,U,z){if(!j)return U;let G=j.content;if(j.propsBinding&&Object.keys(W).length>0){let X=j.propsBinding.trim(),J={...z};if(X.startsWith("{")&&X.endsWith("}")){let Y=X.slice(1,-1).split(",").map((Q)=>Q.trim()).filter(Boolean);for(let Q of Y){let[Z,H]=Q.split(":").map(($)=>$.trim()),_=H||Z;if(W[Z]!==void 0)J[_]=W[Z]}}else J[X]=W;G=k(G,J)}return G}function k(j,W){return j.replace(/\{\{\s*([^}]+)\s*\}\}/g,(U,z)=>{try{let G=z.trim(),X=y(G,W);return I(String(X??""))}catch{return`{{ ${z} }}`}})}function y(j,W){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(j)){let z=j.split("."),G=W;for(let X of z)if(G&&typeof G==="object"&&X in G)G=G[X];else return;return G}let U=j.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(U){let[,z,G,X]=U,J=W[z],Y=parseInt(X,10);if(typeof J==="number")switch(G){case"+":return J+Y;case"-":return J-Y;case"*":return J*Y;case"/":return J/Y}}try{if(!F(j))return;return V(j,Object.keys(W))(...Object.values(W))}catch{return}}async function A(j,W,U){let z=j;z=await v(z,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(J,Y,Q,Z)=>{let H=W.named.get(Y),_=Z?.trim()||"",$=Q||"",K={},O=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,B;while((B=O.exec($))!==null){let L=B[1],q=B[2];K[L]=y(q,U)}return await N(H,K,_,U)});let X=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return z=z.replace(X,(J,Y)=>{if(J.includes("name="))return J;let Q=Y?.trim()||"";return W.default||Q}),z}async function v(j,W,U){let z=[],G=[];j.replace(W,(Y,...Q)=>{let Z=Q[Q.length-2];return G.push({match:Y,index:Z}),z.push(U(Y,...Q.slice(0,-2))),Y});let X=await Promise.all(z),J=j;for(let Y=G.length-1;Y>=0;Y--){let{match:Q,index:Z}=G[Y];J=J.slice(0,Z)+X[Y]+J.slice(Z+Q.length)}return J}function E(j){let W=w(j);return{defaultSlot:W.default,namedSlots:W.named}}async function M(j,W,U,z){return await A(j,{default:W,named:U},z)}
|
|
3
|
-
export{w as Vg,C as Wg,N as Xg,A as Yg,E as Zg,M as _g};
|
package/dist/chunk-fcenm8n1.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{so as b,to as c,uo as d}from"./chunk-kxtqbrfr.js";import{ys as a}from"./chunk-caaenc3w.js";import"./chunk-amxtypkp.js";import"./chunk-nat3actx.js";import"./chunk-q0g5c39d.js";import"./chunk-kffndzch.js";import"./chunk-c2ta859c.js";import"./chunk-r8rbf28v.js";import"./chunk-gptwwv3c.js";import"./chunk-n66k2v2q.js";import"./chunk-vvd659y4.js";import"./chunk-7r80apc5.js";import"./chunk-2tjk867y.js";import"./chunk-t8ctvjqe.js";import"./chunk-deqnt1w5.js";import"./chunk-hzfd8cz0.js";import"./chunk-q569zmrr.js";import"./chunk-hyfjnn7g.js";export{b as rendersAsElement,c as processESImports,d as processComponents,a as freeIdentifiers};
|
package/dist/chunk-gbz6pfs8.js
DELETED
package/dist/chunk-gdbkqatx.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{gm as e,ho as f,io as h,jo as u,ko as l,so as m}from"./chunk-kxtqbrfr.js";import{ot as D}from"./chunk-nat3actx.js";import{gv as g}from"./chunk-deqnt1w5.js";import JJ from"path";import C from"fs";import S from"path";function k(K,Z,$,J){let Q=0;for(let j=Z;j<K.length;j++)if(K[j]===$)Q++;else if(K[j]===J&&!(J===">"&&K[j-1]==="=")){if(--Q===0)return j}return-1}function WJ(K){let Z=D(K),$=0,J=0,Q=[];for(let j=0;j<Z.length;j++)if("([{".includes(Z[j]))$++;else if(")]}".includes(Z[j]))$--;else if(Z[j]===","&&$===0)Q.push(K.slice(J,j).trim()),J=j+1;return Q.push(K.slice(J).trim()),Q}function R(K,Z){let $=D(K),J=new RegExp(`\\b(?:${Z.map((Q)=>Q.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let Q of $.matchAll(J)){let j=Q.index+Q[0].length,G="";if($[j]==="<"){let U=k($,j,"<",">");if(U<0)continue;G=K.slice(j+1,U),j=U+1;while(/\s/.test($[j]||"")&&j<$.length)j++}if($[j]!=="(")continue;let W=k($,j,"(",")");if(W>=0)return{type:G,args:WJ(K.slice(j+1,W))}}return null}var x=`
|
|
3
|
-
type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
|
|
4
|
-
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
5
|
-
type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
|
|
6
|
-
type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K : never }[keyof O];
|
|
7
|
-
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
8
|
-
type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
|
|
9
|
-
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
10
|
-
`;function b(K,Z){let $=[],J={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},Q=D(K),j=K.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(F,H,q,B,Y)=>{if(Q.slice(Y,Y+6)!=="import")return F;if(B.endsWith(".stx"))return"";let N=`${Z}Import${$.length}`;if($.push(`import * as ${N} from ${JSON.stringify(B)};`),H.startsWith("*"))return`import ${H.replace(/^\*\s+as\s+/,"")} = ${N};`;if(!H.startsWith("{"))return`import ${H} = ${N}.default;`;return H.slice(1,-1).split(",").map((M)=>{let[w,O=w]=M.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!w)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(B)&&w in J)J[w].push(O);return`import ${O} = ${N}.${w};`}).join(`
|
|
11
|
-
`)}),G=R(K,J.defineProps),W=R(K,J.defineEmits),U=R(K,J.withDefaults);if(!G&&!W)return{declarations:"",props:null,events:null};let z=[],V=null,X=null;if(G){z.push(`const __options = (${G.args[0]||"{}"}) as const;`),z.push(`const __defaults = (${U?.args[1]||"{}"});`);let F=G.type||"__StxOptions<typeof __options>";z.push(`export type __StxProps = __StxDefaults<${F}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),V=`${Z}.__StxProps`}if(W)z.push(`const __events = (${W.args[0]||"[]"}) as const;`),z.push(`export type __StxEvents = ${W.type||"Record<(typeof __events)[number], any[]>"};`),X=`${Z}.__StxEvents`;return{declarations:`${$.join(`
|
|
12
|
-
`)}
|
|
13
|
-
namespace ${Z} {
|
|
14
|
-
${j}
|
|
15
|
-
${z.join(`
|
|
16
|
-
`)}
|
|
17
|
-
}`,props:V,events:X}}function*UJ(K){let Z=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,$;while($=Z.exec(K)){let J=Z.lastIndex,Q=[];while(J<K.length){while(/\s/.test(K[J]||""))J++;if(K[J]===">"||K.slice(J,J+2)==="/>"){J+=K[J]===">"?1:2;break}let j=/^[^\s=/>]+/.exec(K.slice(J))?.[0];if(!j){J++;continue}let G=J;J+=j.length;while(/\s/.test(K[J]||""))J++;if(K[J]!=="="){Q.push({name:j,value:!0,offset:G,braced:!1});continue}J++;while(/\s/.test(K[J]||""))J++;let W=K[J],U=W==="{",z=W==='"'||W==="'";if(z||U)J++;let V=J;if(U){let X=D(K.slice(J)),F=1,H=0;for(;H<X.length;H++){if(X[H]==="{")F++;if(X[H]==="}"&&--F===0)break}J+=H}else if(z)while(J<K.length&&K[J]!==W)J++;else while(J<K.length&&!/[\s/>]/.test(K[J]))J++;if(Q.push({name:j,value:K.slice(V,J),offset:V,braced:U}),z||U)J++}Z.lastIndex=J,yield{name:$[1],offset:$.index,attributes:Q}}}function p(K,Z,$){let J=[],Q=[x,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],j=new Map,G=new Map,W=new Map,U=$.scriptCode(K,$.filePath),z=D(U);for(let q of U.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(z.slice(q.index,q.index+6)!=="import")continue;let B=q[2],Y=S.isAbsolute(B)||B.startsWith(".")?S.resolve(S.dirname($.filePath),B):h(B,S.dirname($.filePath));if(!Y)continue;let N=Y.endsWith(".stx")?Y:C.existsSync(`${Y}.stx`)?`${Y}.stx`:void 0,M=N?null:f(Y,!1),w=q[1].startsWith("{")?q[1].slice(1,-1).split(","):[q[1]];for(let O of w){let[L,P=L]=O.trim().split(/\s+as\s+/),I=N||M?.get(L)||M?.get(L.toLowerCase());if(I)W.set(P,I),W.set(P.toLowerCase(),I),W.set(P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),I)}}for(let q of Z.matchAll(/@import\s*\(([^)]+)\)/g))for(let B of q[1].matchAll(/['"]([^'"]+)['"]/g)){let Y=u(B[1],$.filePath,$).find((N)=>C.statSync(N,{throwIfNoEntry:!1})?.isFile());if(Y)W.set(S.basename(B[1]).replace(/\.stx$/,""),Y)}let V={__importedComponents:W},X=new Map,F=(q,B,Y)=>{let N=K.slice(0,q);return{code:B,offset:q,attribute:Y,anchor:!0,kind:"directive",line:N.split(`
|
|
18
|
-
`).length,column:q-N.lastIndexOf(`
|
|
19
|
-
`)}},H=(q,B,Y)=>J.push({expression:q,statement:{text:B+q.code+Y,prefixLength:B.length}});for(let q of UJ(Z)){if(m(q.name)||q.name==="component")continue;let B=l(q.name,$.filePath,$,V);if(!B)continue;let Y=X.get(B);if(!Y){let M;try{M=$.readComponent?$.readComponent(B):C.readFileSync(B,"utf8")}catch{continue}if(M===void 0)continue;G.set(B,M),Y=b($.scriptCode(M,B),`__StxComponent${X.size}`),X.set(B,Y),Q.push(Y.declarations)}let N=[];for(let M of q.attributes){let{name:w,offset:O}=M,L=M.value===!0?"true":M.value;if(w.startsWith("@")||w.startsWith("v-on:")){if(Y.events&&M.value!==!0)j.set(O,`__StxEvent<${Y.events}, ${JSON.stringify(w.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let P=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(w);if(w.startsWith("v-")&&!w.startsWith("v-bind:")&&!P)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(w))continue;let I=(P?P[1]||"modelValue":w.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(TJ,zJ)=>zJ.toUpperCase());if(N.push(I),!Y.props)continue;let jJ=w.startsWith(":")||w.startsWith("v-bind:")||!!P||M.braced?L:M.value!==!0?JSON.stringify(L):"true";H(F(O,jJ,w),";void ((",`) satisfies __StxProp<${Y.props}, ${JSON.stringify(I)}>);`)}if(Y.props){let M=[...new Set(N)].map((O)=>`${JSON.stringify(O)}: undefined as any`).join(", "),w=F(q.offset,`<${q.name}>`);J.push({expression:w,statement:{text:`;void ({ ${M} } satisfies ${Y.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:X.size?Q.join(`
|
|
20
|
-
`):"",checks:J,events:j,dependencies:G}}var d=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function GJ(K){let Z=($)=>$.replace(/[^\n]/g," ");return K.replace(/<!--[\s\S]*?-->/g,Z).replace(/\{\{--[\s\S]*?--\}\}/g,Z)}function c(K){let Z=[],$=GJ(K);d.lastIndex=0;let J;while((J=d.exec($))!==null){let Q=(J[1]||"").trim(),j=(J[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,G=(J[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,W=J.index+j,U=J.index+J[0].length-G,z=K.slice(W,U);if(/\bsrc\s*=/.test(Q))continue;let V=Q.match(/\btype\s*=\s*["']([^"']+)["']/i);if(V&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(V[1]))continue;let X=/\bserver\b/.test(Q)?"server":/\bclient\b/.test(Q)?"client":"plain",F=_(K,W);Z.push({kind:X,code:z,startLine:F,attrs:Q})}return Z}function _(K,Z){let $=1;for(let J=0;J<Z&&J<K.length;J++)if(K.charCodeAt(J)===10)$++;return $}function T(K,Z){let $=K.lastIndexOf(`
|
|
21
|
-
`,Z-1)+1;return Z-$+1}function y(K){let Z=K.split(""),$=(Q,j)=>{for(let G=Q;G<j&&G<Z.length;G++)if(Z[G]!==`
|
|
22
|
-
`)Z[G]=" "},J=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let Q of J){Q.lastIndex=0;let j;while((j=Q.exec(K))!==null)$(j.index,j.index+j[0].length)}return Z.join("")}function FJ(K){let Z=0,$="";for(let J=0;J<K.length;J++){let Q=K[J];if($){if(Q==="\\"){J++;continue}if(Q===$)$="";continue}if(Q==='"'||Q==="'"||Q==="`"){$=Q;continue}if(Q==="("||Q==="["||Q==="{"){Z++;continue}if(Q===")"||Q==="]"||Q==="}"){Z--;continue}if(Q==="|"&&Z===0){if(K[J+1]==="|"){J++;continue}if(K[J-1]==="|")continue;return K.slice(0,J)}}return K}var KJ=new Set([":for","x-for","v-for"]),A=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,E="__stx_interpolated",i="__StxElement",QJ="__StxTemplateValue",XJ=`type ${QJ}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function n(K){return K.replace(/\{\{[\s\S]*?\}\}/g,E).replace(/\{!![\s\S]*?!!\}/g,E)}function nJ(K){return K.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(Z)=>{let $=Z.split(`
|
|
23
|
-
`).length-1,J=Z.length-$;return`0${" ".repeat(Math.max(0,J-1))}${`
|
|
24
|
-
`.repeat($)}`})}var VJ=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],HJ=new RegExp(String.raw`^[ \t]*@(?:${VJ.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function rJ(K){return K.replace(HJ,(Z)=>Z.replace(/[^\n]/g," "))}var r=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function YJ(K){let Z=y(K),$=[],J=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,Q;while((Q=J.exec(Z))!==null){if(Q[1]||Q[3])continue;let G=Q[2]??Q[4]??"",W=Q[2]!==void 0?2:3,U=FJ(G);if(!U.trim())continue;let z=Q.index+W+(U.length-U.trimStart().length);$.push({code:U.trim(),line:_(Z,z),column:T(Z,z),offset:z,kind:"interpolation"})}A.lastIndex=0;while((Q=A.exec(Z))!==null){let j=Q[1],G=Q[3]??"",W=j.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(r.has(W)||r.has(j))continue;if(!G.trim())continue;let U=Q.index+Q[0].indexOf(Q[2],Q[0].indexOf(j)+j.length)+1;if(KJ.has(W)){let V=G.match(/\s+(?:in|of)\s+/);if(!V||V.index===void 0)continue;let X=G.slice(V.index+V[0].length),F=V.index+V[0].length+(X.length-X.trimStart().length);$.push({code:n(X.trim()),line:_(Z,U+F),column:T(Z,U+F),offset:U+F,kind:"directive",attribute:W});continue}let z=G.length-G.trimStart().length;$.push({code:n(G.trim()),line:_(Z,U+z),column:T(Z,U+z),offset:U+z,kind:"directive",attribute:W})}return $.sort((j,G)=>j.line-G.line||j.column-G.column),$}var qJ=2000;function BJ(K,Z){let $=0,J=Math.min(K.length,Z+qJ);for(let Q=Z;Q<J;Q++){let j=K[Q];if(j==="(")$++;else if(j===")"){if($--,$===0)return K.slice(Z+1,Q)}}return null}function wJ(K){let Z=new Map,$=(W,U)=>{let z=W.split(/[,[\]{}()\s]+/).filter(Boolean);for(let V of z){let X=V.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(X))continue;let F=z.length===1?U:void 0,H=Z.get(X);if(!H)Z.set(X,{name:X,iterable:F});else if(H.iterable!==F)H.iterable=void 0}},J=/^\$?[A-Z_$][\w$]*$/i,Q=(W)=>{let U=W.trim();return J.test(U)?U:void 0};for(let W of K.matchAll(/@for(?:each|else)\s*\(/g)){let U=BJ(K,W.index+W[0].length-1);if(U===null)continue;let z=U.match(/^([\s\S]*?)\bas\b([\s\S]*)$/);if(!z)continue;$(z[2].replace(/=>/g," "),Q(z[1]))}for(let W of K.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)/g))$(W[1]);let j=y(K);A.lastIndex=0;let G;while((G=A.exec(j))!==null){let W=G[1].replace(/\..*$/,"");if(!KJ.has(W))continue;let U=G[3].match(/\s+(?:in|of)\s+/);if(!U||U.index===void 0)continue;$(G[3].slice(0,U.index),Q(G[3].slice(U.index+U[0].length)))}for(let W of K.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let U of W[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))$(U[1]);return[...Z.values()].sort((W,U)=>W.name.localeCompare(U.name))}function v(K){let Z=new Set;for(let $ of K.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))Z.add($[1]);for(let $ of K.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))Z.add($[1]);for(let $ of K.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))Z.add($[1]);for(let $ of K.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let J of $[1].split(",")){let Q=J.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(Q))Z.add(Q)}return[...Z].sort()}function MJ(){return["declare var window: any",...g.map((K)=>`declare var ${K}: any`)].join(`
|
|
25
|
-
`)}var NJ=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"];function DJ(){return NJ.map((K)=>`declare var ${K}: any`).join(`
|
|
26
|
-
`)}function ZJ(K){let Z=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,$,J=!1,Q=new Set,j=D(K);while(($=Z.exec(j))!==null){J=!0;for(let G of OJ($[1])){let W=G.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(W))Q.add(W)}}return J?[...Q]:null}function OJ(K){let Z=[],$=0,J="";for(let Q of K){if(Q===","&&$===0){Z.push(J),J="";continue}if(Q==="("||Q==="["||Q==="{")$++;else if(Q===")"||Q==="]"||Q==="}")$--;J+=Q}return Z.push(J),Z.filter((Q)=>Q.trim().length>0)}function PJ(K){let Z=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,$=[],J=K.replace(Z,(Q)=>{return $.push(Q.trim()),Q.split(`
|
|
27
|
-
`).map(()=>"").join(`
|
|
28
|
-
`)});return{imports:$.join(`
|
|
29
|
-
`),body:J}}function $J(K){let Z=D(K),$=Array(Z.length),J=0;for(let W=0;W<Z.length;W++){let U=Z[W];if(U==="}"||U===")"||U==="]")J=Math.max(0,J-1);if($[W]=J,U==="{"||U==="("||U==="[")J++}let Q=[],j=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,G;while((G=j.exec(Z))!==null){if($[G.index]!==0)continue;let W=G[1],U=G[2],z;if(W==="interface"){let V=Z.indexOf("{",G.index);if(V===-1)continue;let X=0;z=-1;for(let F=V;F<Z.length;F++)if(Z[F]==="{")X++;else if(Z[F]==="}"&&--X===0){z=F+1;break}if(z===-1)continue}else{let V=0;z=Z.length;for(let X=Z.indexOf("=",G.index)+1;X<Z.length;X++){let F=Z[X];if(F==="{"||F==="["||F==="("||F==="<")V++;else if(F==="}"||F==="]"||F===")"||F===">")V--;else if(V<=0&&(F===";"||F===`
|
|
30
|
-
`&&!/[=|&,<([{]\s*$/.test(Z.slice(Math.max(0,X-40),X)))){z=F===";"?X+1:X;break}}}Q.push({name:U,text:K.slice(G.index,z).replace(/^[ \t]*export[ \t]+/,"")}),j.lastIndex=z}return Q}function IJ(K){return new Set($J(K).map((Z)=>Z.name))}function aJ(K,Z=""){let $=ZJ(K),J=IJ(Z),Q=$J(K).filter((z)=>!J.has(z.name)).map((z)=>z.text);if(!$){let z=v(K);if(z.length===0&&Q.length===0)return"";return["",`// ${SJ}`,...Q,...z.map((V)=>`declare var ${V}: any`)].join(`
|
|
31
|
-
`)}if($.length===0)return Q.length>0?["",`// ${a}`,...Q].join(`
|
|
32
|
-
`):"";let{imports:j,body:G}=PJ(K),W=G.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),U=["",`// ${a}`];if(j)U.push(j);return U.push(...Q),U.push(`async function ${o}() {`,W,` return { ${$.join(", ")} }`,"}",`type ${t} = Awaited<ReturnType<typeof ${o}>>`,...$.map((z)=>`declare var ${z}: ${t}[${JSON.stringify(z)}]`)),U.join(`
|
|
33
|
-
`)}function LJ(K){let $=D(K).split(""),J=0;for(let Q=0;Q<$.length;Q++){let j=$[Q];if(j==="{"||j==="("||j==="["){J++;continue}if(j==="}"||j===")"||j==="]"){J=Math.max(0,J-1);continue}if(J>0&&j!==`
|
|
34
|
-
`)$[Q]=" "}return v($.join(""))}function oJ(K,Z){if(ZJ(K)!==null)return[];let $=D(Z),J=new Set(g);return LJ(K).filter((Q)=>{if(J.has(Q))return!1;if(v(Z).includes(Q))return!1;return new RegExp(`(?<![.#\\w$])${Q}(?![\\w$])`).test($)})}var a="stx: types for the declared client payload (#1868)",SJ="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",o="__stxServerScope",t="__StxClientPayload";var vJ=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var _J=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function yJ(K,Z){let $=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,J=[],Q;while((Q=$.exec(K))!==null){if(Q.index>=Z)break;let j=Q[1];if(j==="endif"||j==="endunless"){J.pop();continue}let G="";if(Q[2]==="("){let W=0,U=Q.index+Q[0].length-1,z=U+1;for(;U<K.length;U++){let V=K[U];if(V==="(")W++;else if(V===")"){if(W--,W===0)break}}G=K.slice(z,U).trim(),$.lastIndex=U+1}if(j==="if")J.push({seen:[],current:G});else if(j==="unless")J.push({seen:[],current:`!(${G})`});else if(j==="elseif"||j==="else"){let W=J[J.length-1];if(!W)continue;if(W.current)W.seen.push(W.current);W.current=j==="elseif"?G:null}}return J.flatMap((j)=>[...j.seen.map((G)=>`!(${G})`),...j.current?[j.current]:[]]).filter(Boolean)}function AJ(K){let Z=K.code.trim();if(!Z)return null;if(K.attribute?.startsWith("@")){if(_J.test(Z))return null;let J=";(($event: any): void => { ";return{text:`${J}${Z} });`,prefixLength:J.length}}let $=";void ((";return{text:`${$}${Z}));`,prefixLength:$.length}}var RJ=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function s(K,Z){if(!Z)return K;return K.replace(RJ,($,J,Q,j)=>{let G=JJ.resolve(Z,j).replace(/\\/g,"/");return`${J}${Q}${G}${Q}`})}function tJ(K,Z={}){let $=c(K),J=K.split(`
|
|
35
|
-
`),Q=Array.from({length:J.length},()=>""),j=new Map,G=Z.filePath&&Z.templateExpressions!==!1?p(K,y(K),{filePath:Z.filePath,componentsDir:Z.componentsDir,projectRoot:Z.projectRoot,readComponent:Z.readComponent,scriptCode:(U,z)=>c(U).map((V)=>s(V.code,JJ.dirname(z))).join(`
|
|
36
|
-
`)}):void 0;for(let U of $)s(U.code,Z.originDir??"").split(`
|
|
37
|
-
`).forEach((V,X)=>{let F=U.startLine-1+X;if(F<Q.length)Q[F]=V});let W=(U,z)=>{for(let[V,X]of U.split(`
|
|
38
|
-
`).entries())if(Q.push(X),z)j.set(Q.length,V===0?z:{...z,line:z.line+V,column:1,prefixLength:0})};if(Z.globals!==!1){if(W(""),Z.runtimeGlobals!==!1)for(let z of MJ().split(`
|
|
39
|
-
`))W(z);for(let z of DJ().split(`
|
|
40
|
-
`))W(z);for(let z of e)W(`declare var ${z}: any`);for(let z of vJ)W(`declare var ${z}: any`);W(`declare var ${E}: any`);let U=new Set($.flatMap((z)=>v(z.code)));W(`type ${i}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let z of wJ(K)){if(U.has(z.name))continue;let V=z.iterable&&U.has(z.iterable)?`${i}<typeof ${z.iterable}>`:"any";W(`declare var ${z.name}: ${V}`)}}if(Z.templateExpressions!==!1){if(G?.declarations)for(let z of G.declarations.split(`
|
|
41
|
-
`))W(z);let U=YJ(K).map((z)=>{let V=G?.events.get(z.offset??-1);if(V){z.anchor=!0;let X=z.code.trim(),F=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(X),H=F?`void ((${F[2]}) satisfies __StxAssignedValue<typeof ${F[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(X)?`${X}($event)`:X,q=`;(($event: ${V}): void => { `;return{expression:z,statement:{text:`${q}${H} });`,prefixLength:q.length}}}return{expression:z,statement:AJ(z)}}).filter((z)=>z.statement!==null);if(U.push(...G?.checks||[]),U.length>0){let z=y(K),X=[...new Set($.flatMap((H)=>v(H.code)))].filter((H)=>/^[A-Z_$][\w$]*$/i.test(H)),F=0;if(X.length>0){W(XJ);for(let H of X)W(`type __StxT_${H} = ${QJ}<typeof ${H}>`);W(`;((${X.map((H)=>`${H}: __StxT_${H}`).join(", ")}) => {`),F=1}for(let{expression:H,statement:q}of U){let B=" ".repeat(F),Y=H.offset===void 0?[]:yJ(z,H.offset),N=Y.length>0?`${Y.map((w)=>`if (${w}) `).join("")}{ `:"",M=Y.length>0?" }":"";W(B+N+q.text+M,{line:H.line,column:H.column,expression:H,prefixLength:q.prefixLength+B.length+N.length})}if(F>0)W("});")}}return W("export {}"),{text:Q.join(`
|
|
42
|
-
`),lineMap:j,sourceLineCount:J.length,componentDependencies:G?.dependencies}}function sJ(K,Z,$){let J=K.lineMap.get(Z);if(!J)return Z<=K.sourceLineCount?{line:Z,column:$}:null;let Q=J.expression?.anchor?0:Math.max(0,$-1-(J.prefixLength??0));return{line:J.line,column:J.column+Q,expression:J.expression}}
|
|
43
|
-
export{c as Xf,nJ as Yf,rJ as Zf,YJ as _f,v as $f,DJ as ag,aJ as bg,oJ as cg,s as dg,tJ as eg,sJ as fg};
|
package/dist/chunk-jnahcd4d.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Al as e,Bl as f,Cl as g,wl as a,xl as b,yl as c,zl as d}from"./chunk-p1hy2bwn.js";import"./chunk-r8rbf28v.js";import"./chunk-gptwwv3c.js";import"./chunk-vvd659y4.js";import"./chunk-hzfd8cz0.js";import"./chunk-hyfjnn7g.js";export{e as productionApiDispatcher,g as isServerApiSource,b as generateApiTypes,a as discoverServerApi,f as createServerApi,d as createApiDispatcher,c as buildServerApi};
|
package/dist/chunk-krpkfndf.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{ct as Q}from"./chunk-caaenc3w.js";import"./chunk-amxtypkp.js";import{Cu as R}from"./chunk-gptwwv3c.js";import"./chunk-hyfjnn7g.js";import O from"fs";import U from"path";async function W(j,b={}){let q=Date.now(),z={total:0,passed:0,failed:0,new:0,failures:[],duration:0},K=b.snapshotDir||R(j.root,"story","snapshots");await O.promises.mkdir(K,{recursive:!0});let B=j.storyFiles;if(b.filter&&b.filter.length>0)B=B.filter((J)=>b.filter.some((G)=>J.fileName.toLowerCase().includes(G.toLowerCase())));for(let J of B)await X(J,K,b,z);return z.duration=Date.now()-q,z}async function X(j,b,q,z){let K=j.story;if(!K)return;for(let B of K.variants){z.total++;let J=U.join(b,`${j.id}-${B.id}.snap`),G=Y(B.source||""),L=await _(J);if(q.update||!L){let M={storyId:j.id,variantId:B.id,component:j.fileName,timestamp:Date.now(),hash:G};if(await O.promises.writeFile(J,JSON.stringify(M,null,2)),!L)z.new++;z.passed++}else try{let M=await O.promises.readFile(J,"utf-8"),N=JSON.parse(M);if(N.hash===G)z.passed++;else z.failed++,z.failures.push({storyId:j.id,variantId:B.id,component:j.fileName,message:"Snapshot mismatch",difference:Z(N.hash,G)})}catch(M){z.failed++,z.failures.push({storyId:j.id,variantId:B.id,component:j.fileName,message:`Error reading snapshot: ${M}`})}}}async function A(j,b={}){return(await W(j,{...b,update:!0})).total}function Y(j){let b=0;for(let q=0;q<j.length;q++){let z=j.charCodeAt(q);b=(b<<5)-b+z,b=b&b}return b.toString(16)}function Z(j,b){if(j===b)return 0;let q=Math.abs(Number.parseInt(j,16)-Number.parseInt(b,16));return Math.min(q/1e6,1)}async function _(j){try{return await O.promises.access(j),!0}catch{return!1}}function I(j){let b=[];if(b.push(""),b.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),b.push(" STX Story Visual Regression Tests"),b.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),b.push(""),j.failures.length>0){b.push(" \u274C Failures:"),b.push("");for(let q of j.failures){if(b.push(` \u2022 ${q.component} / ${q.variantId}`),b.push(` ${q.message}`),q.difference!==void 0)b.push(` Difference: ${(q.difference*100).toFixed(2)}%`);b.push("")}}if(b.push(" Summary:"),b.push(` Total: ${j.total}`),b.push(` Passed: ${j.passed} \u2713`),b.push(` Failed: ${j.failed} \u2717`),j.new>0)b.push(` New: ${j.new} \u26A1`);return b.push(` Time: ${j.duration}ms`),b.push(""),b.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),b.push(""),b.join(`
|
|
3
|
-
`)}async function S(j,b={}){let q=performance.now(),z=[],K=0,B=0;for(let G of j.storyFiles)try{let L=await Bun.file(G.path).text(),M=await Q(L,G.path);if(M.length>0){for(let N of M)z.push({storyId:G.id,variantId:"default",component:G.component,message:`A11y: ${N.message}`,expected:"No accessibility violations",actual:`${N.type}: ${N.message} (impact: ${N.impact})`});B++}else K++}catch(L){z.push({storyId:G.id,variantId:"default",component:G.component,message:`Failed to check a11y: ${L instanceof Error?L.message:String(L)}`,expected:"File readable for a11y check",actual:"File read error"}),B++}let J=performance.now()-q;return{total:j.storyFiles.length,passed:K,failed:B,new:0,failures:z,duration:J}}export{A as updateSnapshots,W as runVisualTests,S as runA11yTests,I as formatTestResults};
|