@stacksjs/stx 0.2.378 → 0.2.379
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/{chunk-kb6h4vf7.js → chunk-0380epk7.js} +1 -1
- package/dist/{chunk-ds9hax17.js → chunk-05c62pqd.js} +1 -1
- package/dist/{chunk-h0k7xkah.js → chunk-05rf12xd.js} +1 -1
- package/dist/{chunk-jehmjxnq.js → chunk-0m9dp2nx.js} +1 -1
- package/dist/{chunk-b3rqr465.js → chunk-0nknfsxa.js} +1 -1
- package/dist/{chunk-ghn6rvgw.js → chunk-123vn4r5.js} +45 -45
- package/dist/{chunk-4znpx8a5.js → chunk-21kjq7eq.js} +1 -1
- package/dist/{chunk-skpj0796.js → chunk-2ggshmdx.js} +1 -1
- package/dist/chunk-367ce1y2.js +2 -0
- package/dist/chunk-3ckt56vs.js +2 -0
- package/dist/{chunk-75d91rgh.js → chunk-3gj9jts7.js} +1 -1
- package/dist/{chunk-8dqjqnes.js → chunk-4tarjrqw.js} +119 -119
- package/dist/{chunk-w499e1n1.js → chunk-5ztqaab9.js} +1 -1
- package/dist/{chunk-mrxrz9b1.js → chunk-7j6stht9.js} +1 -1
- package/dist/chunk-7ngmxv4z.js +47 -0
- package/dist/{chunk-yfqxzkex.js → chunk-836z41ss.js} +1 -1
- package/dist/{chunk-tm8v7xc0.js → chunk-8kwmj99g.js} +1 -1
- package/dist/chunk-8nxdktsm.js +2 -0
- package/dist/{chunk-vak9j9cc.js → chunk-93f8avhm.js} +1 -1
- package/dist/{chunk-x3e2wvk5.js → chunk-9n88pgdr.js} +1 -1
- package/dist/{chunk-gagw5rvw.js → chunk-an5y1z0q.js} +1 -1
- package/dist/{chunk-tnv2bhye.js → chunk-bhbex20z.js} +1 -1
- package/dist/{chunk-8ys85nkt.js → chunk-bzcg4efj.js} +2 -2
- package/dist/{chunk-ywcx2q3t.js → chunk-cjxs8r0c.js} +1 -1
- package/dist/{chunk-s54sn5xa.js → chunk-ctkz8peg.js} +1 -1
- package/dist/chunk-dvc615rq.js +2 -0
- package/dist/{chunk-zw91ws20.js → chunk-e4kxhcyn.js} +1 -1
- package/dist/{chunk-at4s8qvj.js → chunk-e854gjy9.js} +1 -1
- package/dist/{chunk-4v4xer9k.js → chunk-ev7q8enz.js} +2 -2
- package/dist/chunk-fdc118yv.js +2 -0
- package/dist/{chunk-74efeytn.js → chunk-g4q00dv4.js} +1 -1
- package/dist/{chunk-abp8t91q.js → chunk-geztv535.js} +1 -1
- package/dist/{chunk-rfq5h4zn.js → chunk-gy8m2nrh.js} +1 -1
- package/dist/chunk-h58jrhw7.js +2 -0
- package/dist/{chunk-rft4sz7t.js → chunk-j19ep0nb.js} +1 -1
- package/dist/{chunk-v48ngnf4.js → chunk-jxcjp8f8.js} +1 -1
- package/dist/{chunk-sc5kdhc5.js → chunk-ksfmp87v.js} +1 -1
- package/dist/{chunk-aj6dbp5y.js → chunk-mva7ef38.js} +1 -1
- package/dist/{chunk-dnctgb5m.js → chunk-mywxdq28.js} +1 -1
- package/dist/{chunk-cf7qz2yz.js → chunk-nh6p0k17.js} +1 -1
- package/dist/chunk-qj58fpc2.js +2 -0
- package/dist/{chunk-41hqk2fp.js → chunk-reafpw3e.js} +1 -1
- package/dist/{chunk-dahpshkz.js → chunk-s5r9pd0e.js} +2 -2
- package/dist/{chunk-dvd2c0ab.js → chunk-sqj46125.js} +1 -1
- package/dist/chunk-sy5x1tma.js +2 -0
- package/dist/chunk-tep3p25g.js +2 -0
- package/dist/{chunk-f95kp2ch.js → chunk-tfk1w25g.js} +1 -1
- package/dist/{chunk-8h4het40.js → chunk-vafmd261.js} +1 -1
- package/dist/{chunk-054eyrwg.js → chunk-xa8ry8an.js} +1 -1
- package/dist/{chunk-vvzw2vyk.js → chunk-xf1dwv3x.js} +1 -1
- package/dist/{chunk-0vgw4496.js → chunk-yz2yk0p1.js} +17 -17
- package/dist/{chunk-ewr4ym70.js → chunk-z3rm0hsv.js} +1 -1
- package/dist/{chunk-x5bsgr9k.js → chunk-zhzcahz5.js} +1 -1
- package/dist/{chunk-0gbbfr5v.js → chunk-zs8tf2cm.js} +1 -1
- package/dist/{chunk-vsvjw3bp.js → chunk-zwnh04k9.js} +1 -1
- package/dist/chunk-zzgkm8ee.js +2 -0
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/env.js +6 -3
- package/dist/props.js +2 -1
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-4r1safma.js +0 -2
- package/dist/chunk-ab52p413.js +0 -2
- package/dist/chunk-akvf7pgp.js +0 -2
- package/dist/chunk-cqs0hfrw.js +0 -2
- package/dist/chunk-qweye95d.js +0 -2
- package/dist/chunk-rc3d4yyy.js +0 -2
- package/dist/chunk-ryc446j9.js +0 -2
- package/dist/chunk-s7nd2979.js +0 -47
- package/dist/chunk-s9j8pgz8.js +0 -2
- package/dist/chunk-x2r3gjtw.js +0 -2
- package/dist/chunk-x8vhy875.js +0 -2
package/dist/chunk-s7nd2979.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Tw as z}from"./chunk-myyj9qp3.js";var Vq={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"}},L={},u="en";function Gq(q){u=q}function Bq(){return u}function Hq(q){L={...L,...q}}function Wq(){L={}}function f(q,J={}){let Q=L[q]||Vq[q]||{message:`Unknown error (code: ${q})`},Z=Q.message,$=Q.help;for(let[X,V]of Object.entries(J)){let Y=`{{${X}}}`;if(Z=Z.replace(new RegExp(Y,"g"),V),$)$=$.replace(new RegExp(Y,"g"),V)}return{message:Z,help:$}}function Mq(q,J={}){let{message:Q,help:Z}=f(q,J);return Z?`${Q}
|
|
3
|
-
Help: ${Z}`:Q}var w={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 S(q){for(let[J,Q]of Object.entries(w))if(Q===q)return J;return}function Iq(){return!1}function k(){return!Iq()||process.env.STX_DEBUG==="true"}function aq(){return!1}import wq from"path";var x={showRelativePaths:!1,enableAutoRecovery:k(),logRecoveryWarnings:!0},D={...x};function Fq(q){D={...D,...q}}function _(){return{...D}}function jq(){D={...x}}function N(q){if(!D.showRelativePaths||!q)return q;let J=D.baseDir||process.cwd();try{let Q=wq.relative(J,q);return Q.startsWith("..")?q:Q}catch{return q}}class U extends Error{code;filePath;line;column;context;numericCode;constructor(q,J,Q,Z,$,X,V){super(q);this.code=J;this.filePath=Q;this.line=Z;this.column=$;this.context=X;if(this.name="StxError",this.numericCode=V||w.EVALUATION_ERROR,this.filePath)this.filePath=N(this.filePath)}}class m extends U{constructor(q,J,Q,Z,$,X){super(q,"stx_SYNTAX_ERROR",J,Q,Z,$,X||w.INVALID_DIRECTIVE_SYNTAX);this.name="StxSyntaxError"}}class c extends U{constructor(q,J,Q,Z,$,X){super(q,"stx_RUNTIME_ERROR",J,Q,Z,$,X||w.EVALUATION_ERROR);this.name="StxRuntimeError"}}class d extends U{constructor(q,J,Q,Z,$,X){super(q,"stx_SECURITY_ERROR",J,Q,Z,$,X||w.UNSAFE_EXPRESSION);this.name="StxSecurityError"}}class p extends U{constructor(q,J,Q,Z,$,X){super(q,"stx_FILE_ERROR",J,Q,Z,$,X||w.FILE_NOT_FOUND);this.name="StxFileError"}}class l extends U{isFatal=!0;constructor(q,J,Q,Z,$,X){super(q,"stx_VALIDATION_ERROR",J,Q,Z,$,X||w.DOM_API_VIOLATION);this.name="StxValidationError"}}function P(q){let{type:J,message:Q,code:Z,filePath:$,line:X,column:V,template:Y,offset:B,snippet:G,suggestion:H,format:W="text"}=q,M=X,I=V;if(!M&&Y&&B!==void 0){let y=s(Y,B);M=y.line,I=y.column}let j=$?N($):void 0,Yq=Z?S(Z):void 0,K={type:J,code:Z,codeName:Yq,message:Q,filePath:j,line:M,column:I,snippet:G,suggestion:H,timestamp:new Date().toISOString()},O;switch(W){case"html":O=Dq(K);break;case"json":O=JSON.stringify(K,null,2);break;case"console":O=Kq(K,Y,B);break;case"text":default:O=Uq(K,Y,B);break}return{formatted:O,data:K}}function Uq(q,J,Q){let Z=[],$=q.code?` [${q.codeName||q.code}]`:"";if(Z.push(`[${q.type} Error${$}]`),q.filePath){let X=q.filePath;if(q.line){if(X+=`:${q.line}`,q.column)X+=`:${q.column}`}Z.push(`at ${X}`)}if(Z.push(`
|
|
4
|
-
${q.message}`),J&&q.line){let X=Oq(J,q.line,2);if(X)Z.push(`
|
|
5
|
-
${X}`)}if(q.snippet)Z.push(`
|
|
6
|
-
Snippet: ${q.snippet}`);if(q.suggestion)Z.push(`
|
|
7
|
-
Suggestion: ${q.suggestion}`);return Z.join(" ")}function Dq(q){let J=q.code?` [${q.code}]`:"",Q=q.filePath?` in ${q.filePath}${q.line?`:${q.line}`:""}`:"",Z=`<!-- [${q.type} Error${J}]${Q}: ${o(q.message)}`;if(q.suggestion)Z+=` | Suggestion: ${o(q.suggestion)}`;return Z+=" -->",Z}function Kq(q,J,Q){let G=[],H=q.code?` [${q.codeName||q.code}]`:"";if(G.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${q.type} Error${H} \u2501\u2501\u2501${"\x1B[0m"}`),q.filePath){let W=`\x1B[36m${q.filePath}\x1B[0m`;if(q.line){if(W+=`\x1B[90m:${q.line}\x1B[0m`,q.column)W+=`\x1B[90m:${q.column}\x1B[0m`}G.push(`
|
|
8
|
-
\x1B[90mat\x1B[0m ${W}`)}if(G.push(`
|
|
9
|
-
|
|
10
|
-
${q.message}`),J&&q.line){let W=kq(J,q.line,2);if(W)G.push(`
|
|
11
|
-
|
|
12
|
-
\x1B[90mContext:\x1B[0m
|
|
13
|
-
${W}`)}if(q.suggestion)G.push(`
|
|
14
|
-
|
|
15
|
-
\x1B[33mSuggestion:\x1B[0m ${q.suggestion}`);return G.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"}`),G.join("")}function Oq(q,J,Q){let Z=q.split(`
|
|
17
|
-
`),$=Math.max(0,J-Q-1),X=Math.min(Z.length-1,J+Q-1),V=[];for(let Y=$;Y<=X;Y++){let B=(Y+1).toString().padStart(4),G=Y===J-1?">":" ";V.push(`${G}${B} | ${Z[Y]}`)}return V.join(`
|
|
18
|
-
`)}function kq(q,J,Q){let Z=q.split(`
|
|
19
|
-
`),$=Math.max(0,J-Q-1),X=Math.min(Z.length-1,J+Q-1),V="\x1B[90m",Y="\x1B[31m",B="\x1B[0m",G=[];for(let H=$;H<=X;H++){let W=(H+1).toString().padStart(4),M=H===J-1,I=M?"\x1B[31m>\x1B[0m":" ",j=M?`\x1B[31m${Z[H]}\x1B[0m`:`\x1B[90m${Z[H]}\x1B[0m`;G.push(`${I}\x1B[90m${W}\x1B[0m | ${j}`)}return G.join(`
|
|
20
|
-
`)}function o(q){return q.replace(/--/g,"- -").replace(/>/g,">")}function s(q,J){let Z=q.substring(0,J).split(`
|
|
21
|
-
`);return{line:Z.length,column:Z[Z.length-1].length}}function zq(q,J,Q){return P({type:q,message:J,code:Q,format:"html"}).formatted}function Lq(q,J,Q,Z,$){return P({type:q,message:J,code:$,filePath:Q,line:Z,format:"console"}).formatted}function _q(q,J,Q){let Z=Q.template.split(`
|
|
22
|
-
`),$=s(Q.template,Q.offset),X=`[${q} Error at line ${$.line} in ${Q.filePath}]: ${J}
|
|
23
|
-
|
|
24
|
-
`,V=Math.max(0,$.line-3),Y=Math.min(Z.length-1,$.line+2);X+=`Context:
|
|
25
|
-
`;for(let B=V;B<=Y;B++){let G=B+1,H=Z[B]||"",W=B===$.line-1?">":" ";X+=`${W} ${G.toString().padStart(3)}: ${H}
|
|
26
|
-
`}if($.line-1<Z.length){let B=" ".repeat($.column+5);X+=`${B}^
|
|
27
|
-
`}return X}function Nq(q,J,Q){try{return q()}catch(Z){if(Q&&Z instanceof Error)Q(Z);return J}}async function Tq(q,J,Q){try{return await q()}catch(Z){if(Q&&Z instanceof Error)Q(Z);return J}}var Aq={isEnabled(){return _().enableAutoRecovery},fixCommonSyntaxErrors(q){let J=_();if(!J.enableAutoRecovery)return{fixed:q,fixes:[]};let Q=q,Z=[],$=(Q.match(/\{\{/g)||[]).length,X=(Q.match(/\}\}/g)||[]).length;if($>X){let Y=$-X;Q+="}}".repeat(Y),Z.push(`Added ${Y} missing closing braces '}}'`)}let V=["if","foreach","for","switch","section"];for(let Y of V){let B=(Q.match(new RegExp(`@${Y}\\b`,"g"))||[]).length,G=(Q.match(new RegExp(`@end${Y}\\b`,"g"))||[]).length;if(B>G){let H=B-G;for(let W=0;W<H;W++)Q+=`
|
|
28
|
-
@end${Y}`;Z.push(`Added ${H} missing @end${Y}`)}}if(Z.length>0&&J.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Z.forEach((Y)=>console.warn(` - ${Y}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Q,fixes:Z}},createFallbackContent(q,J){if(k())return`<!-- ${q} failed: ${J.message} -->`;return"<!-- stx rendering error -->"}};class C{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,J,Q="error"){let Z={timestamp:new Date,error:q,context:J,level:Q};if(this.errors.push(Z),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Q))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 J=[`[${q.timestamp.toISOString()}] [${(q.level||"error").toUpperCase()}] ${q.error.constructor.name}: ${q.error.message}`];if(q.error.stack)J.push(` Stack: ${q.error.stack.split(`
|
|
29
|
-
`).slice(1).join(`
|
|
30
|
-
`)}`);if(q.context)J.push(` Context: ${JSON.stringify(q.context)}`);return J.join(`
|
|
31
|
-
`)}writeToFile(q){this.writeQueue=this.writeQueue.then(async()=>{try{let J=await import("fs"),Z=(await import("path")).dirname(this.logFilePath);if(!J.existsSync(Z))J.mkdirSync(Z,{recursive:!0});await this.rotateIfNeeded(J);let $=`${this.formatEntry(q)}
|
|
32
|
-
`;J.appendFileSync(this.logFilePath,$,"utf-8")}catch(J){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",J)}})}async rotateIfNeeded(q){try{if(!q.existsSync(this.logFilePath))return;if(q.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Q=this.maxLogFiles-1;Q>=1;Q--){let Z=`${this.logFilePath}.${Q}`,$=`${this.logFilePath}.${Q+1}`;if(q.existsSync(Z))if(Q>=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(J){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",J)}}getRecentErrors(q=10){return this.errors.slice(-q)}getErrorsByType(q){return this.errors.filter((J)=>J.error.constructor.name===q)}getErrorsByLevel(q){return this.errors.filter((J)=>J.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={},J={error:0,warning:0,info:0};for(let Q of this.errors){let Z=Q.error.constructor.name;q[Z]=(q[Z]||0)+1;let $=Q.level||"error";J[$]=(J[$]||0)+1}return{total:this.errors.length,byType:q,byLevel:J}}async exportToFile(q,J="json"){let Q=await import("fs"),$=(await import("path")).dirname(q);if(!Q.existsSync($))Q.mkdirSync($,{recursive:!0});if(J==="json"){let X=this.errors.map((V)=>({timestamp:V.timestamp.toISOString(),level:V.level||"error",type:V.error.constructor.name,message:V.error.message,stack:V.error.stack,context:V.context}));Q.writeFileSync(q,JSON.stringify(X,null,2),"utf-8")}else{let X=this.errors.map((V)=>this.formatEntry(V));Q.writeFileSync(q,X.join(`
|
|
33
|
-
|
|
34
|
-
`),"utf-8")}}async flush(){await this.writeQueue}}var Rq=new C,bq={isDevelopment(){return k()},logDetailedError(q,J){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",q.message),console.error("Stack:",q.stack),J)console.error("Context:",J);console.error("========================")},createErrorReport(q,J){let Q=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${q.message}`,`Type: ${q.constructor.name}`,`Stack: ${q.stack}`];if(J)Q.push(`Context: ${JSON.stringify(J,null,2)}`);return Q.push("========================"),Q.join(`
|
|
35
|
-
`)}};import g from"path";var v={isValidFilePath(q,J){let Q=q.replace(/\\/g,"/");if(Q.includes("\x00"))return!1;if(Q.includes("../")||Q.includes("..\\")||Q===".."||Q.startsWith("../")||Q.endsWith("/..")||Q.includes("/..\\")||Q.includes("\\../"))return!1;if(/^[a-z][a-z0-9+.-]*:/i.test(Q))return!1;if(Q.startsWith("/")){if(["/etc/","/root/","/var/","/usr/","/bin/","/sbin/","/proc/","/sys/","/dev/","/boot/","/home/","/private/","/Library/","/System/"].some((X)=>Q===X.slice(0,-1)||Q.startsWith(X)))return!1}if(/^[a-z]:/i.test(Q)){if(["Windows/","Windows\\","System32/","System32\\","Program Files/","Program Files\\"].some((X)=>Q.includes(X)))return!1}if(J){let $=g.resolve(J,q),X=g.resolve(J);if(!$.startsWith(X+g.sep)&&$!==X)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((Q)=>Q.test(q))}};function Sq(q){let J={"&":"&","<":"<",">":">",'"':""","'":"'"};return q.replace(/[&<>"']/g,(Q)=>J[Q]||Q)}function T(q,J={}){let{allowHtml:Q=!1,maxLength:Z=1e4,allowSpecialChars:$=!0,customSanitizer:X}=J,V=[],Y=q,B=!1;if(X){let H=X(Y);if(H!==Y)Y=H,B=!0}if(Y.includes("\x00"))Y=Y.replace(/\0/g,""),B=!0,V.push("Null bytes removed from parameter");if(Y.length>Z)Y=Y.substring(0,Z),B=!0,V.push(`Parameter truncated to ${Z} characters`);if(!Q&&/<[^>]+>/.test(Y))Y=Sq(Y),B=!0,V.push("HTML content was escaped");let G=[{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:H,replacement:W,name:M}of G)if(H.test(Y))Y=Y.replace(H,W),B=!0,V.push(`Removed ${M} from parameter`);if(!$){let H=Y;if(Y=Y.split("").filter((W)=>{let M=W.charCodeAt(0);return M>=32&&M!==127}).join(""),Y!==H)B=!0,V.push("Control characters removed")}return{value:Y,modified:B,warnings:V}}function Pq(q,J){let Q=q.replace(/\0/g,"");Q=Q.replace(/\\/g,"/"),Q=Q.replace(/^[a-z][a-z0-9+.-]*:/i,"");while(Q.includes("../")||Q.includes("./"))Q=Q.replace(/\.\.\//g,"").replace(/\.\//g,"");if(!v.isValidFilePath(Q,J))return null;return Q}function Cq(q){let J=[],Q=q.trim(),Z=Q!==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:X,name:V}of $)if(X.test(Q))J.push(`Potentially dangerous pattern detected: ${V}`);if(Q.includes("\x00"))Q=Q.replace(/\0/g,""),Z=!0,J.push("Null bytes removed from expression");return{value:Q,modified:Z,warnings:J}}function gq(q,J={}){return q.map((Q)=>T(Q,J))}function r(q){let J={};for(let[Q,Z]of Object.entries(q)){if(!v.isValidVariableName(Q))continue;if(typeof Z==="string"){let $=T(Z);J[Q]=$.value}else if(Array.isArray(Z))J[Q]=Z.map(($)=>typeof $==="string"?T($).value:$);else if(typeof Z==="object"&&Z!==null)J[Q]=r(Z);else J[Q]=Z}return J}var vq={maxSanitizeDepth:10,allowBracketNotation:!1},e={...vq};var R=/\bnew\s+/,b="__stx_safe_ctors",qq=[/\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*\(/,R,/\bdelete\s+/,/\bthis\b/],hq=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",b]),Jq=new Set(["__proto__","constructor","prototype"]),Eq=/[\w)\]]\s*\[\s*['"]/;function Qq(q){let J="",Q=[],Z=null,$=!1;for(let X=0;X<q.length;X++){let V=q[X];if($){$=!1;continue}if(V==="\\"&&Z){$=!0;continue}if(Z){if(Z==="`"&&V==="$"&&X+1<q.length&&q[X+1]==="{"){let Y=1;X+=2;while(X<q.length&&Y>0){if(q[X]==="{")Y++;else if(q[X]==="}")Y--;if(Y>0)J+=q[X],Q.push(X),X++}continue}if(V===Z)Z=null;continue}if(V==='"'||V==="'"||V==="`"){Z=V;continue}J+=V,Q.push(X)}return{text:J,map:Q}}function yq(q){return Qq(q).text}var Zq=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],$q=(()=>{let q={Date,URL,URLSearchParams},J=Intl;for(let Q of Zq)if(typeof J[Q]==="function")q[`Intl_${Q}`]=J[Q];return Object.freeze(Object.assign(Object.create(null),q))})(),uq=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,n=/(?<![\w$])new(?![\w$])/g,i=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Zq.join(",")}}() are allowed`;function fq(q){let{text:J,map:Q}=Qq(q),Z=[];n.lastIndex=0;let $;while(($=n.exec(J))!==null){let V=$.index;if(/(?<!\.)\.\s*$/.test(J.slice(0,V)))continue;let Y=uq.exec(J.slice(V)),B=Y?.[3],G=!Y?null:B?`Intl_${B}`:Y[2];if(!Y||!G||!(G in $q))throw new F(`matched /${R.source}/; ${i}`,q);let H=V+Y[0].length,W=Q[V],M=Q[H-1]+1;if(q.slice(W,M)!==J.slice(V,H))throw new F(`matched /${R.source}/; ${i}`,q);let I=W+3+Y[1].length;Z.push({start:I,end:I+Y[2].length,key:G})}let X=q;for(let V=Z.length-1;V>=0;V--){let Y=Z[V];X=`${X.slice(0,Y.start)}${b}.${Y.key}${X.slice(Y.end)}`}return{source:X,usesSafeConstructors:Z.length>0}}class F extends Error{rule;expression;constructor(q,J,Q){super(Q??`Potentially unsafe expression (${q}): ${J}`);this.name="UnsafeExpressionError",this.rule=q,this.expression=J}}function KJ(q){try{return E(q),null}catch(J){return J instanceof F?J.rule:J instanceof Error?J.message:String(J)}}function xq(q,J){let Q=/[$A-Z_a-z][$\w]*/g,Z;while((Z=Q.exec(q))!==null){let $=Z[0],X=q[Z.index-1];if(hq.has($))throw new F(`matched /\\b${$}\\b/; identifier ${$}`,J);if(X==="."&&Jq.has($))throw new F(`matched /.${$}/; property ${$}`,J)}}function mq(q){let J=/\[\s*(['"])(.*?)\1\s*\]/g,Q;while((Q=J.exec(q))!==null){let Z=Q[2];if(!Jq.has(Z))continue;let $=q.slice(0,Q.index).match(/\S(?=\s*$)/)?.[0],X=q.slice(Q.index+Q[0].length).match(/^\s*(\S)/)?.[1];if(!(($==="{"||$===",")&&X===":"))throw new F(`bracket key ${Q[2]}`,q)}}function E(q){let J=q.trim(),Q=yq(J);xq(Q,J),mq(J);for(let Z of qq){if(Z===R)continue;if(Z.test(Q))throw new F(`matched /${Z.source}/`,J)}if(!e.allowBracketNotation&&Eq.test(J))throw new F("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",J,`Bracket notation with strings not allowed: ${J}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return fq(J)}function cq(q){return E(q),q.trim()}function dq(q){let J={};J.Math=Math,J.JSON=JSON,J.Date=Date,J.String=String,J.Number=Number,J.Boolean=Boolean,J.Array=Array,J.parseInt=Number.parseInt,J.parseFloat=Number.parseFloat,J.isNaN=Number.isNaN,J.isFinite=Number.isFinite,J.encodeURIComponent=encodeURIComponent,J.decodeURIComponent=decodeURIComponent;for(let[Q,Z]of Object.entries(q)){if(Q.startsWith("__")||qq.some(($)=>$.test(Q)))continue;if(Z&&typeof Z==="object"&&!Array.isArray(Z))J[Q]=h(Z);else J[Q]=Z}return J}function h(q,J=0){if(J>=e.maxSanitizeDepth)return"[Object too deep]";if(q===null||typeof q!=="object")return q;if(Array.isArray(q))return q.map((Z)=>h(Z,J+1));if(q instanceof Date||q instanceof RegExp||q instanceof Map||q instanceof Set||q instanceof Error)return q;let Q={};for(let[Z,$]of Object.entries(q)){if(Z.startsWith("__")||Z==="constructor"||Z==="prototype")continue;if($&&typeof $==="object")Q[Z]=h($,J+1);else Q[Z]=$}return Q}function pq(q,J){try{let Q=dq(J),Z=Object.keys(Q),$=Object.values(Q);return rq(q,Z)(...$)}catch{return}}function OJ(q){try{return cq(q),!0}catch{return!1}}function kJ(q,J){try{let Q=pq(q,J);if(Q&&typeof Q==="object"&&!Array.isArray(Q))return Q;return{}}catch{return{}}}var Xq=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"]),lq=2000,A=new Map;function a(q,J){let Q=`${q.join(",")}\x00${J}`,Z=A.get(Q);if(Z)return Z;let $=Function(...q,J);if(A.size>=lq)A.clear();return A.set(Q,$),$}function zJ(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 oq=/^[A-Za-z_$][\w$]*$/;function sq(q){return oq.test(q)&&!Xq.has(q)}function rq(q,J){let{source:Q,usesSafeConstructors:Z}=E(q),$=[];for(let G=0;G<J.length;G++){if(!sq(J[G]))continue;if(J[G]===b)continue;$.push({key:J[G],index:G})}$.sort((G,H)=>G.key.localeCompare(H.key));let X=$.map((G)=>G.key),V=$.map((G)=>G.index),Y=`
|
|
36
|
-
'use strict';
|
|
37
|
-
try {
|
|
38
|
-
return ${Q};
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
if (e instanceof TypeError) {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
throw e;
|
|
45
|
-
}
|
|
46
|
-
`;return nq(Z?(G)=>{let H=a([b,...X,...G],Y);return(...W)=>H($q,...W)}:(G)=>a([...X,...G],Y),X,J,$,V)}function nq(q,J,Q,Z,$){let X=q([]),V=Z.every((B,G)=>B.index===G);if(J.length===Q.length&&V)return t(X,J,q);return t((...B)=>{let G=Array($.length);for(let H=0;H<$.length;H++)G[H]=B[$[H]];return X(...G)},J,q,(B)=>{X=q(B)})}function t(q,J,Q,Z){let X=/^(\w+) is not defined$/,V=q,Y=[],B=new Set(J);return(...G)=>{for(let H=0;H<=8;H++)try{return V(...G)}catch(W){let M=W instanceof Error?W.message:"",I=X.exec(M);if(!(W instanceof ReferenceError)||!I)return;let j=I[1];if(B.has(j)||Xq.has(j))return;if(B.add(j),Y.push(j),Z)Z(Y);else V=Q(Y)}return}}function LJ(q){let J=q.trim(),Q=[/\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 Q)if(Z.test(J))return!1;return!0}
|
|
47
|
-
export{Gq as Du,Bq as Eu,Hq as Fu,Wq as Gu,f as Hu,Mq as Iu,w as Ju,S as Ku,Iq as Lu,k as Mu,aq as Nu,Fq as Ou,_ as Pu,jq as Qu,N as Ru,U as Su,m as Tu,c as Uu,d as Vu,p as Wu,l as Xu,P as Yu,zq as Zu,Lq as _u,_q as $u,Nq as av,Tq as bv,Aq as cv,C as dv,Rq as ev,bq as fv,v as gv,T as hv,Pq as iv,Cq as jv,gq as kv,r as lv,KJ as mv,cq as nv,dq as ov,pq as pv,OJ as qv,kJ as rv,zJ as sv,sq as tv,rq as uv,LJ as vv};
|
package/dist/chunk-s9j8pgz8.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Po as a,Qo as b,Ro as c,So as d}from"./chunk-0vgw4496.js";import"./chunk-cf7qz2yz.js";import"./chunk-49trnqad.js";import"./chunk-c0vjhzjf.js";import"./chunk-vjn3r3sq.js";import"./chunk-cbj5a2tk.js";import"./chunk-ds9hax17.js";import"./chunk-2zbmyvqc.js";import"./chunk-sjpjge04.js";import"./chunk-kb6h4vf7.js";import"./chunk-k6bagvmz.js";import"./chunk-x5bsgr9k.js";import"./chunk-tm8v7xc0.js";import"./chunk-s7nd2979.js";import"./chunk-s3tpyage.js";import"./chunk-2sa8rk32.js";import"./chunk-x8t29tnr.js";import"./chunk-0xh7vqce.js";import"./chunk-wqa77pdn.js";import"./chunk-myyj9qp3.js";export{b as reportDeferredLoopWarnings,c as processLoops,a as parseLoopBinding,d as declareBareLoopHead};
|
package/dist/chunk-x2r3gjtw.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{lk as a,mk as b,nk as c,ok as d}from"./chunk-41hqk2fp.js";import"./chunk-dahpshkz.js";import"./chunk-0vgw4496.js";import"./chunk-cf7qz2yz.js";import"./chunk-49trnqad.js";import"./chunk-c0vjhzjf.js";import"./chunk-vjn3r3sq.js";import"./chunk-cbj5a2tk.js";import"./chunk-ds9hax17.js";import"./chunk-2zbmyvqc.js";import"./chunk-sjpjge04.js";import"./chunk-kb6h4vf7.js";import"./chunk-k6bagvmz.js";import"./chunk-x5bsgr9k.js";import"./chunk-tm8v7xc0.js";import"./chunk-s7nd2979.js";import"./chunk-s3tpyage.js";import"./chunk-2sa8rk32.js";import"./chunk-x8t29tnr.js";import"./chunk-0xh7vqce.js";import"./chunk-wqa77pdn.js";import"./chunk-myyj9qp3.js";export{b as getAvailableTargets,c as getAvailableFormats,d as default,a as buildNative};
|
package/dist/chunk-x8vhy875.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Jp as b,Kp as c,Lp as d,Mp as e,no as a}from"./chunk-0vgw4496.js";import"./chunk-cf7qz2yz.js";import"./chunk-49trnqad.js";import"./chunk-c0vjhzjf.js";import"./chunk-vjn3r3sq.js";import"./chunk-cbj5a2tk.js";import"./chunk-ds9hax17.js";import"./chunk-2zbmyvqc.js";import"./chunk-sjpjge04.js";import"./chunk-kb6h4vf7.js";import"./chunk-k6bagvmz.js";import"./chunk-x5bsgr9k.js";import"./chunk-tm8v7xc0.js";import"./chunk-s7nd2979.js";import"./chunk-s3tpyage.js";import"./chunk-2sa8rk32.js";import"./chunk-x8t29tnr.js";import"./chunk-0xh7vqce.js";import"./chunk-wqa77pdn.js";import"./chunk-myyj9qp3.js";export{d as validateClientScript,c as processOnceDirective,b as processJsonDirective,e as processDirectives,a as injectRouterScript};
|