@stacksjs/stx-vscode 0.2.849 → 0.2.850
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.
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)
|
|
3
|
-
`)return-1;if(i==="\\"){t+=2;continue}if(i==="[")
|
|
4
|
-
`)
|
|
1
|
+
var Dt=Object.create;var{getPrototypeOf:Mt,defineProperty:$e,getOwnPropertyNames:It}=Object;var Ce=Object.prototype.hasOwnProperty;function Lt(e){return this[e]}var Ot,jt,X=(e,n,t)=>{var s=e!=null&&typeof e==="object";if(s){var i=n?Ot??=new WeakMap:jt??=new WeakMap,o=i.get(e);if(o)return o}t=e!=null?Dt(Mt(e)):{};let r=n||!e||!e.__esModule||!Ce.call(e,"default")?$e(t,"default",{value:e,enumerable:!0}):t;if(e&&typeof e==="object"||typeof e==="function"){for(let a of It(e))if(!Ce.call(r,a))$e(r,a,{get:Lt.bind(e,a),enumerable:!0})}if(s)i.set(e,r);return r};var vt=require("node:crypto"),z=require("node:fs"),Tt=require("node:os"),B=X(require("node:path"));var pe=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var be=X(require("node:path"),1);function Bt(e,n){let t=e[n],s=n+1;while(s<e.length){if(e[s]==="\\"){s+=2;continue}if(e[s]===t)return s+1;s++}return e.length}function Nt(e,n){let t=n+1;while(t<e.length){if(e[t]==="\\"){t+=2;continue}if(e[t]==="`")return t+1;if(e[t]==="$"&&e[t+1]==="{"){if(t=_e(e,t+2),t<e.length)t++;continue}t++}return e.length}function _e(e,n){let t=1,s=n,i="{",o="";while(s<e.length){let r=e[s];if(r==="\\"){s+=2;continue}if(r==='"'||r==="'"){s=Bt(e,s),i=Z,o="";continue}if(r==="`"){s=Nt(e,s),i=Z,o="";continue}if(r==="/"&&e[s+1]==="/"){while(s<e.length&&e[s]!==`
|
|
2
|
+
`)s++;continue}if(r==="/"&&e[s+1]==="*"){s+=2;while(s<e.length&&e.slice(s,s+2)!=="*/")s++;s+=2;continue}if(r==="/"&&ke(i,o)){let a=Ae(e,s);if(a!==-1){s=a,i=Z,o="";continue}}if(r==="{")t++;else if(r==="}"){if(t--,t===0)return s}if(/[\w$]/.test(r))o=/[\w$]/.test(i)?o+r:r,i=r;else if(!/\s/.test(r))i=r,o="";s++}return e.length}var Vt=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]);function ke(e,n){if(n)return Vt.has(n);return!(e===")"||e==="]"||e===Z)}var Z="\x00";function Ae(e,n){let t=n+1,s=!1;while(t<e.length){let i=e[t];if(i===`
|
|
3
|
+
`)return-1;if(i==="\\"){t+=2;continue}if(i==="[")s=!0;else if(i==="]")s=!1;else if(i==="/"&&!s){t++;while(t<e.length&&/[a-z]/i.test(e[t]))t++;return t}t++}return-1}function O(e){let n="",t=0,s="",i="";while(t<e.length){let o=e.slice(t,t+2);if(o==="//"){while(t<e.length&&e[t]!==`
|
|
4
|
+
`)n+=" ",t++;continue}if(o==="/*"){while(t<e.length&&e.slice(t,t+2)!=="*/")n+=e[t]===`
|
|
5
5
|
`?`
|
|
6
|
-
`:" ",t++;
|
|
6
|
+
`:" ",t++;n+=" ",t+=2;continue}let r=e[t];if(r==='"'||r==="'"){let a=r;n+=" ",t++;while(t<e.length&&e[t]!==a){if(e[t]==="\\"){n+=" ",t+=2;continue}n+=e[t]===`
|
|
7
7
|
`?`
|
|
8
|
-
`:" ",t++}
|
|
8
|
+
`:" ",t++}n+=" ",t++,s=Z,i="";continue}if(r==="/"&&ke(s,i)){let a=Ae(e,t);if(a!==-1){n+=`/${" ".repeat(a-t-2)}/`,t=a,s=Z,i="";continue}}if(r==="`"){n+=" ",t++;while(t<e.length&&e[t]!=="`"){if(e[t]==="\\"){n+=" ",t+=2;continue}if(e[t]==="$"&&e[t+1]==="{"){let a=t+2,c=_e(e,a);if(n+=" ",n+=O(e.slice(a,c)),c<e.length)n+=" ";t=c+1;continue}n+=e[t]===`
|
|
9
9
|
`?`
|
|
10
|
-
`:" ",t++}
|
|
10
|
+
`:" ",t++}n+=" ",t++,s=Z,i="";continue}if(n+=r,t++,/[\w$]/.test(r))i=/[\w$]/.test(s)?i+r:r,s=r;else if(!/\s/.test(r))s=r,i=""}return n}function oe(e){let n=new Uint16Array(e.length),t=0,s=!0;for(let i=0;i<e.length;i++){let o=e[i];if(o===")"||o==="]"||o==="}")if(t===0)s=!1;else t--;if(n[i]=t,o==="("||o==="["||o==="{")t++}return{depths:n,balanced:s&&t===0}}class me{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,n){this.maxSize=e,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(e){if(!this.cache.has(e))return;let n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}set(e,n){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(n):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let s=this.cache.keys().next().value;if(s===void 0)break;this.delete(s)}if(this.cache.set(e,n),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let n=this.sizes.get(e);if(n!==void 0)this.bytes-=n,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}class Re{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let n=Array.from(new Set(e)),t=n.sort().join(","),s=this.pool.find((a)=>a.context.join(",")===t);if(s)return s.func;let i=this.fnCache,o=this.fnCacheMaxSize,r=(...a)=>(c)=>{try{let u=`${t}:${c}`,f=i.get(u);if(!f){if(i.size>=o){let m=i.keys().next().value;if(m)i.delete(m)}f=Function(...n,`
|
|
11
11
|
'use strict';
|
|
12
12
|
try {
|
|
13
13
|
return ${c};
|
|
@@ -18,7 +18,7 @@ catch (e) {
|
|
|
18
18
|
}
|
|
19
19
|
throw e;
|
|
20
20
|
}
|
|
21
|
-
`),i.set(f
|
|
21
|
+
`),i.set(u,f)}return f(...a)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:r,context:n.slice()});return r}clear(){this.pool.length=0,this.fnCache.clear()}}var zn=new Re;class Pe{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}setBudget(e,n){this.budgets.set(e,{warnThreshold:0.8,action:"warn",...n})}setBudgets(e){for(let[n,t]of Object.entries(e))this.setBudget(n,t)}removeBudget(e){this.budgets.delete(e)}getBudgets(){let e={};for(let[n,t]of this.budgets.entries())e[n]=t;return e}onViolation(e){this.violationHandlers.push(e)}offViolation(e){let n=this.violationHandlers.indexOf(e);if(n!==-1)this.violationHandlers.splice(n,1)}time(e,n){if(!this.enabled)return n();let t=performance.now(),s=n(),i=performance.now()-t;return this.recordTime(e,i),this.checkBudget(e,i),s}async timeAsync(e,n){if(!this.enabled)return n();let t=performance.now(),s=await n(),i=performance.now()-t;return this.recordTime(e,i),this.checkBudget(e,i),s}checkBudget(e,n){let t=this.budgets.get(e);if(!t)return;let s=n/t.maxTime*100,i=t.warnThreshold!==void 0?n>=t.maxTime*t.warnThreshold&&n<t.maxTime:!1,o=n>=t.maxTime;if(!i&&!o)return;let r={label:e,actualTime:n,budgetTime:t.maxTime,exceedancePercent:s,timestamp:new Date,isWarning:i};this.violations.push(r);while(this.violations.length>this.maxViolations)this.violations.shift();for(let c of this.violationHandlers)try{c(r)}catch{}let a=i?`[Performance Warning] "${e}" took ${n.toFixed(2)}ms (${s.toFixed(1)}% of ${t.maxTime}ms budget)`:`[Performance Budget Exceeded] "${e}" took ${n.toFixed(2)}ms (exceeded ${t.maxTime}ms budget by ${(s-100).toFixed(1)}%)`;switch(t.action){case"log":console.log(a);break;case"warn":console.warn(a);break;case"error":console.error(a);break;case"throw":if(o)throw Error(a);else console.warn(a);break}}recordTime(e,n){let t=this.metrics.get(e);if(t)t.count++,t.totalTime+=n,t.maxTime=Math.max(t.maxTime,n),t.minTime=Math.min(t.minTime,n);else this.metrics.set(e,{count:1,totalTime:n,maxTime:n,minTime:n})}getStats(e){if(e){let t=this.metrics.get(e);if(!t)return{};let s=this.budgets.get(e);return{count:t.count,avgTime:t.totalTime/t.count,totalTime:t.totalTime,maxTime:t.maxTime,minTime:t.minTime,budget:s?.maxTime,budgetUtilization:s?t.totalTime/t.count/s.maxTime*100:void 0}}let n={};for(let[t,s]of this.metrics.entries()){let i=this.budgets.get(t);n[t]={count:s.count,avgTime:s.totalTime/s.count,totalTime:s.totalTime,maxTime:s.maxTime,minTime:s.minTime,budget:i?.maxTime,budgetUtilization:i?s.totalTime/s.count/i.maxTime*100:void 0}}return n}getViolations(e){if(e)return this.violations.filter((n)=>n.label===e);return[...this.violations]}getViolationStats(){let e={},n=0,t=0;for(let s of this.violations)if(e[s.label]=(e[s.label]||0)+1,s.isWarning)n++;else t++;return{total:this.violations.length,byLabel:e,warnings:n,errors:t}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var ge=null;function zt(){if(!ge)ge=new Pe;return ge}var Fn=new Proxy({},{get(e,n){return zt()[n]}});var Gn=new me(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4});function De(e){let n=e.indexOf(" as ");if(n!==-1){let o=e.slice(0,n).trim(),r=e.slice(n+4).trim();return o&&r?{arrayExpr:o,itemVar:r}:null}let t=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!t)return null;let s=t[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),i=t[2].trim();return s&&i?{arrayExpr:i,itemVar:s}:null}var Q=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useBroadcastStream","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useNativeDesktop","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"];var Ft=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var Qn=Q.filter((e)=>!Ft.includes(e));var Kt=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],Wt=["x-init","x-transition","x-effect","x-on"],Jn=[...Kt,...Wt];var ae=X(require("node:fs"),1),J=X(require("node:path"),1);function Me(e,n,t,s){let i=0;for(let o=n;o<e.length;o++)if(e[o]===t)i++;else if(e[o]===s&&!(s===">"&&e[o-1]==="=")){if(--i===0)return o}return-1}function Ht(e){let n=O(e),t=0,s=0,i=[];for(let o=0;o<n.length;o++)if("([{".includes(n[o]))t++;else if(")]}".includes(n[o]))t--;else if(n[o]===","&&t===0)i.push(e.slice(s,o).trim()),s=o+1;return i.push(e.slice(s).trim()),i}function he(e,n){let t=O(e),s=new RegExp(`\\b(?:${n.map((i)=>i.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let i of t.matchAll(s)){let o=i.index+i[0].length,r="";if(t[o]==="<"){let c=Me(t,o,"<",">");if(c<0)continue;r=e.slice(o+1,c),o=c+1;while(/\s/.test(t[o]||"")&&o<t.length)o++}if(t[o]!=="(")continue;let a=Me(t,o,"(",")");if(a>=0)return{type:r,args:Ht(e.slice(o+1,a))}}return null}var Ie=`
|
|
22
22
|
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;
|
|
23
23
|
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
24
24
|
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>;
|
|
@@ -26,40 +26,43 @@ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K
|
|
|
26
26
|
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
27
27
|
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]> };
|
|
28
28
|
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
29
|
-
`;function Le(e,
|
|
30
|
-
`)}),
|
|
29
|
+
`;function Le(e,n){let t=[],s={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},i=O(e),o=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(h,w,C,v,d)=>{if(i.slice(d,d+6)!=="import")return h;if(v.endsWith(".stx"))return"";let T=`${n}Import${t.length}`;if(t.push(`import * as ${T} from ${JSON.stringify(v)};`),w.startsWith("*"))return`import ${w.replace(/^\*\s+as\s+/,"")} = ${T};`;if(!w.startsWith("{"))return`import ${w} = ${T}.default;`;return w.slice(1,-1).split(",").map((E)=>{let[x,A=x]=E.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!x)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(v)&&x in s)s[x].push(A);return`import ${A} = ${T}.${x};`}).join(`
|
|
30
|
+
`)}),r=he(e,s.defineProps),a=he(e,s.defineEmits),c=he(e,s.withDefaults);if(!r&&!a)return{declarations:"",props:null,events:null};let u=[],f=null,m=null;if(r){u.push(`const __options = (${r.args[0]||"{}"}) as const;`),u.push(`const __defaults = (${c?.args[1]||"{}"});`);let h=r.type||"__StxOptions<typeof __options>";u.push(`export type __StxProps = __StxDefaults<${h}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),f=`${n}.__StxProps`}if(a)u.push(`const __events = (${a.args[0]||"[]"}) as const;`),u.push(`export type __StxEvents = ${a.type||"Record<(typeof __events)[number], any[]>"};`),m=`${n}.__StxEvents`;return{declarations:`${t.join(`
|
|
31
31
|
`)}
|
|
32
|
-
namespace ${
|
|
33
|
-
${
|
|
34
|
-
${
|
|
32
|
+
namespace ${n} {
|
|
33
|
+
${o}
|
|
34
|
+
${u.join(`
|
|
35
35
|
`)}
|
|
36
|
-
}`,props:
|
|
37
|
-
`).length,column:C-
|
|
38
|
-
`)}},
|
|
39
|
-
`):"",checks:
|
|
40
|
-
`,
|
|
41
|
-
`)
|
|
42
|
-
`),K=
|
|
43
|
-
`)),
|
|
36
|
+
}`,props:f,events:m}}var q=X(require("node:fs"),1),R=X(require("node:path"),1);function je(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Oe=new Map;function Be(e,n=!0){let t=Oe.get(e);if(n&&t)return t;let s=new Map,i=[R.default.join(e,"src"),R.default.join(e,"dist"),e];function o(r,a){if(a>6)return;let c;try{c=q.default.readdirSync(r,{withFileTypes:!0})}catch{return}for(let u of c){let f=R.default.join(r,u.name);if(u.isDirectory()){if(u.name==="node_modules"||u.name.startsWith("."))continue;o(f,a+1)}else if(u.isFile()&&u.name.endsWith(".stx")){let m=u.name.slice(0,-4);if(!s.has(m))s.set(m,f);let h=m.toLowerCase();if(!s.has(h))s.set(h,f);let w=je(m);if(!s.has(w))s.set(w,f)}}}for(let r of i)if(o(r,0),s.size>0)break;if(n)Oe.set(e,s);return s}function Ne(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let t=n;while(!0){let s=R.default.join(t,"node_modules",e);try{if(q.default.statSync(s).isDirectory())return s}catch{}let i=R.default.dirname(t);if(i===t)return null;t=i}}function Ve(e,n,t={}){return[R.default.resolve(R.default.dirname(n),`${e}.stx`),R.default.resolve(R.default.dirname(n),e),R.default.resolve(t.componentsDir||"components",`${e}.stx`),R.default.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function ze(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,t=n.split("-").map((i)=>i.charAt(0).toUpperCase()+i.slice(1)).join(""),s=je(n);return[n,t,s]}function Gt(e,n){let[t,s,i]=ze(e);for(let o of[t,t.toLowerCase(),s,i]){let r=n?.__importedComponents?.get(o);if(r!==void 0)return r}}function Ut(e,n){let t=n?R.default.resolve(n):void 0,s=R.default.dirname(R.default.resolve(e));for(;;){if(q.default.existsSync(R.default.join(s,"package.json")))return t&&s===t?void 0:s;let i=R.default.dirname(s);if(i===s)return;s=i}}var Xt=["src/ui","src/components","components","dist"];function Zt(e,n){let t=R.default.resolve(e);if(!n&&!t.split(R.default.sep).includes("node_modules"))return[];let s=Ut(t,n);if(!s)return[];let i=[];try{let a=JSON.parse(q.default.readFileSync(R.default.join(s,"package.json"),"utf8")).stx?.components;if(Array.isArray(a))i=a.filter((c)=>typeof c==="string")}catch{}let o=i.length?i:Xt;return[R.default.dirname(R.default.resolve(e)),...o.map((r)=>R.default.resolve(s,r))]}function*qt(e,n,t={},s){let i=ze(e);if(i[0].startsWith("./")||i[0].startsWith("../")){yield R.default.resolve(R.default.dirname(n),`${i[0]}.stx`);return}let o=[...new Set(i.map((c)=>`${c}.stx`))],r=t.projectRoot||process.cwd(),a=[...Zt(n,t.projectRoot),...s?.__originalFilePath?[R.default.join(R.default.dirname(s.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],R.default.join(R.default.dirname(n),"components"),R.default.resolve(r,"src/components"),R.default.resolve(r,"components"),R.default.resolve("/home/runner/work/stx/stx/packages/stx/src","components")];for(let c of new Set(a)){for(let u of o)yield R.default.join(c,u);try{for(let u of q.default.readdirSync(c,{withFileTypes:!0}))if(u.isDirectory())for(let f of o)yield R.default.join(c,u.name,f)}catch{}}}function Fe(e,n,t={},s){let i=Gt(e,s);if(i!==void 0)return i;for(let o of qt(e,n,t,s))try{if(q.default.statSync(o,{throwIfNoEntry:!1})?.isFile())return o}catch{}return null}var Ke=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function We(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Ke].some((n)=>n.toLowerCase()===e.toLowerCase());return Ke.has(e)||/[A-Z]/.test(e)}function*Yt(e){let n=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,t;while(t=n.exec(e)){let s=n.lastIndex,i=[];while(s<e.length){while(/\s/.test(e[s]||""))s++;if(e[s]===">"||e.slice(s,s+2)==="/>"){s+=e[s]===">"?1:2;break}let o=/^[^\s=/>]+/.exec(e.slice(s))?.[0];if(!o){s++;continue}let r=s;s+=o.length;while(/\s/.test(e[s]||""))s++;if(e[s]!=="="){i.push({name:o,value:!0,offset:r,braced:!1});continue}s++;while(/\s/.test(e[s]||""))s++;let a=e[s],c=a==="{",u=a==='"'||a==="'";if(u||c)s++;let f=s;if(c){let m=O(e.slice(s)),h=1,w=0;for(;w<m.length;w++){if(m[w]==="{")h++;if(m[w]==="}"&&--h===0)break}s+=w}else if(u)while(s<e.length&&e[s]!==a)s++;else while(s<e.length&&!/[\s/>]/.test(e[s]))s++;if(i.push({name:o,value:e.slice(f,s),offset:f,braced:c}),u||c)s++}n.lastIndex=s,yield{name:t[1],offset:t.index,attributes:i}}}function He(e,n,t){let s=[],i=[Ie,"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 __StxStaticProp<P, K> = __StxProp<P, K> extends infer T ? boolean extends T ? T | "true" | "false" : T : never;','type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? number extends E[K]["length"] ? E[K][0] : Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],o=new Map,r=new Map,a=new Map,c=t.scriptCode(e,t.filePath),u=O(c);for(let C of c.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(u.slice(C.index,C.index+6)!=="import")continue;let v=C[2],d=J.default.isAbsolute(v)||v.startsWith(".")?J.default.resolve(J.default.dirname(t.filePath),v):Ne(v,J.default.dirname(t.filePath));if(!d)continue;let T=d.endsWith(".stx")?d:ae.default.existsSync(`${d}.stx`)?`${d}.stx`:void 0,E=T?null:Be(d,!1),x=C[1].startsWith("{")?C[1].slice(1,-1).split(","):[C[1]];for(let A of x){let[_,y=_]=A.trim().split(/\s+as\s+/),D=T||E?.get(_)||E?.get(_.toLowerCase());if(D)a.set(y,D),a.set(y.toLowerCase(),D),a.set(y.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),D)}}for(let C of n.matchAll(/@import\s*\(([^)]+)\)/g))for(let v of C[1].matchAll(/['"]([^'"]+)['"]/g)){let d=Ve(v[1],t.filePath,t).find((T)=>ae.default.statSync(T,{throwIfNoEntry:!1})?.isFile());if(d)a.set(J.default.basename(v[1]).replace(/\.stx$/,""),d)}let f={__importedComponents:a},m=new Map,h=(C,v,d)=>{let T=e.slice(0,C);return{code:v,offset:C,attribute:d,anchor:!0,kind:"directive",line:T.split(`
|
|
37
|
+
`).length,column:C-T.lastIndexOf(`
|
|
38
|
+
`)}},w=(C,v,d)=>s.push({expression:C,statement:{text:v+C.code+d,prefixLength:v.length}});for(let C of Yt(n)){if(We(C.name)||C.name==="component")continue;let v=Fe(C.name,t.filePath,t,f);if(!v)continue;let d=m.get(v);if(!d){let E;try{E=t.readComponent?t.readComponent(v):ae.default.readFileSync(v,"utf8")}catch{continue}if(E===void 0)continue;r.set(v,E),d=Le(t.scriptCode(E,v),`__StxComponent${m.size}`),m.set(v,d),i.push(d.declarations)}let T=[];for(let E of C.attributes){let{name:x,offset:A}=E,_=E.value===!0?"true":E.value;if(x.startsWith("@")||x.startsWith("v-on:")){if(d.events&&E.value!==!0)o.set(A,`__StxEvent<${d.events}, ${JSON.stringify(x.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let y=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(x);if(x.startsWith("v-")&&!x.startsWith("v-bind:")&&!y)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(x))continue;let D=(y?y[1]||"modelValue":x.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(F,j)=>j.toUpperCase());if(T.push(D),!d.props)continue;let N=x.startsWith(":")||x.startsWith("v-bind:")||!!y||E.braced,P=N?_:E.value!==!0?JSON.stringify(_):"true",M=!N&&E.value!==!0&&(_==="true"||_==="false");w(h(A,P,x),";void ((",`) satisfies ${M?"__StxStaticProp":"__StxProp"}<${d.props}, ${JSON.stringify(D)}>);`)}if(d.props){let E=[...new Set(T)].map((A)=>`${JSON.stringify(A)}: undefined as any`).join(", "),x=h(C.offset,`<${C.name}>`);s.push({expression:x,statement:{text:`;void ({ ${E} } satisfies ${d.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:m.size?i.join(`
|
|
39
|
+
`):"",checks:s,events:o,dependencies:r}}function Ge(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let n=[],t=[],s=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let i of e.matchAll(s)){let o=i[0];if(/^<\/template\s*>$/i.test(o)){let r=t.pop();if(r)r.end=i.index}else if(/^<template\b/i.test(o)&&!/\/\s*>$/.test(o)){let a=[...o.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((f)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(f[1])),c=(a?.[2]??a?.[3])?.trim();if(c&&a?.[1]==="data-stx-slot-binding")try{c=decodeURIComponent(c)}catch{c=void 0}let u=c?{start:i.index+o.length,end:e.length,binding:c}:void 0;if(t.push(u),u)n.push(u)}}return n}var Ue=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Qt(e){let n=(t)=>t.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,n).replace(/\{\{--[\s\S]*?--\}\}/g,n)}function le(e){let n=[],t=Qt(e);Ue.lastIndex=0;let s;while((s=Ue.exec(t))!==null){let i=(s[1]||"").trim(),o=(s[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,r=(s[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,a=s.index+o,c=s.index+s[0].length-r,u=e.slice(a,c);if(/\bsrc\s*=/.test(i))continue;let f=i.match(/\btype\s*=\s*["']([^"']+)["']/i);if(f&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(f[1]))continue;let m=/\bserver\b/.test(i)?"server":/\bclient\b/.test(i)?"client":"plain",h=te(e,a);n.push({kind:m,code:u,startLine:h,startColumn:ne(e,a),offset:a,attrs:i})}return n}function te(e,n){let t=1;for(let s=0;s<n&&s<e.length;s++)if(e.charCodeAt(s)===10)t++;return t}function ne(e,n){let t=e.lastIndexOf(`
|
|
40
|
+
`,n-1)+1;return n-t+1}function ue(e){let n=e.split(""),t=(i,o)=>{for(let r=i;r<o&&r<n.length;r++)if(n[r]!==`
|
|
41
|
+
`)n[r]=" "},s=[/<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 i of s){i.lastIndex=0;let o;while((o=i.exec(e))!==null)t(o.index,o.index+o[0].length)}return n.join("")}function nt(e){let n=0,t="";for(let s=0;s<e.length;s++){let i=e[s];if(t){if(i==="\\"){s++;continue}if(i===t)t="";continue}if(i==='"'||i==="'"||i==="`"){t=i;continue}if(i==="("||i==="["||i==="{"){n++;continue}if(i===")"||i==="]"||i==="}"){n--;continue}if(i==="|"&&n===0){if(e[s+1]==="|"){s++;continue}if(e[s-1]==="|")continue;return e.slice(0,s)}}return e}var st=new Set([":for","x-for","v-for"]),fe=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,xe="__stx_interpolated",Xe="__StxElement",it="__StxTemplateValue",Jt=`type ${it}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Ze(e){return e.replace(/\{\{[\s\S]*?\}\}/g,xe).replace(/\{!![\s\S]*?!!\}/g,xe)}function en(e,n,t){let s=0;for(let i=n;i<e.length;i++){let o=e[i];if(o==="{"){s++;continue}if(o!=="}"&&o!=="!")continue;if(e.startsWith(t,i)&&s===0)return i;if(o==="}"&&s>0)s--}return-1}function tn(e,n,t="0"){let s=`__stxScript${t}`;while((e+n).includes(s))s+="_";let i=new Map,o=[],r=[],a=O(e),c=se(e),u=[],f=0;for(let d=0;d<a.length;d++){let T=a.startsWith("{{",d);if(!T&&!a.startsWith("{!!",d))continue;let E=T?2:3,x=T?"}}":"!!}",A=en(a,d+E,x);if(A<0)continue;let _=d,y=e.slice(_,A+x.length),D=y.slice(E,-x.length);d=A+x.length-1;let N=r.length,P=Y(c,_),M=Y(c,_+(T?2:3));r.push({code:nt(D),...M});let F=`${s}_${N}`,j=y.split(`
|
|
42
|
+
`),K=j[0].length;j[0]=F+" ".repeat(Math.max(0,K-F.length));for(let H=1;H<j.length;H++)j[H]=j[H].replace(/[^\r]/g," ");let W=i.get(P.line)??[],V=W.at(-1),re=P.column+(V?V.generatedEnd-V.sourceEnd:0);W.push({sourceStart:P.column,sourceEnd:P.column+K,generatedStart:re,generatedEnd:re+j[0].length}),i.set(P.line,W),u.push(e.slice(f,_),j.join(`
|
|
43
|
+
`)),f=_+y.length}u.push(e.slice(f));let m=u.join("");if(!r.length)return{code:m,columns:i,declarations:o};let{imports:h,body:w}=ln(n),C=[],v=0;for(let d of h.split(/\n(?=import\b)/)){if(!d.trim())continue;let T=/^import\s+(?:type\s+)?([\s\S]+?)\s+from\s*(['"][^'"]+['"])/.exec(d);if(!T){o.push({text:d});continue}let E=`${s}Module${v++}`;o.push({text:`import * as ${E} from ${T[2]}`});let x=T[1],A=/\{([\s\S]*?)\}/.exec(x);for(let N of A?.[1].split(",")??[]){let[P,M=P]=N.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(P==="default")C.push(`const ${M} = ${E}.default; type ${M} = import(${T[2]}).default`);else if(P)C.push(`import ${M} = ${E}.${P}`)}let _=x.replace(/\{[\s\S]*?\}/,""),y=/\*\s+as\s+(\w+)/.exec(_);if(y)C.push(`import ${y[1]} = ${E}`);let D=/^\s*([\w$]+)/.exec(_)?.[1];if(D)C.push(`const ${D} = ${E}.default; type ${D} = import(${T[2]}).default`)}o.push({text:`namespace ${s}Scope {
|
|
44
44
|
${C.join(`
|
|
45
45
|
`)}
|
|
46
46
|
export async function read() {
|
|
47
|
-
${rt(
|
|
48
|
-
return {`});for(let[d,
|
|
47
|
+
${rt(w).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,"")}
|
|
48
|
+
return {`});for(let[d,T]of r.entries())o.push({text:`value${d}: (`}),o.push({text:T.code,origin:{line:T.line,column:T.column}}),o.push({text:"),"});o.push({text:`}
|
|
49
49
|
}
|
|
50
|
-
}`});for(let d=0;d<
|
|
50
|
+
}`});for(let d=0;d<r.length;d++)o.push({text:`declare var ${s}_${d}: Awaited<ReturnType<typeof ${s}Scope.read>>['value${d}']`});return{code:m,columns:i,declarations:o}}function qe(e,n){let t=0;for(let s of e){if(n<s.generatedStart)break;if(n<s.generatedEnd)return s.sourceStart+Math.min(n-s.generatedStart,s.sourceEnd-s.sourceStart);t=s.sourceEnd-s.generatedEnd}return n+t}function Ye(e,n){let t=0;for(let s of e){if(n<s.sourceStart)break;if(n<s.sourceEnd)return s.generatedStart+Math.min(n-s.sourceStart,s.generatedEnd-s.generatedStart);t=s.generatedEnd-s.sourceEnd}return n+t}var nn=["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"],sn=new RegExp(String.raw`^[ \t]*@(?:${nn.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function rt(e){return e.replace(sn,(n)=>n.replace(/[^\n]/g," "))}var Qe=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function rn(e){let n=ue(e),t=[],s=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,i;while((i=s.exec(n))!==null){if(i[1]||i[3])continue;let a=i[2]??i[4]??"",c=i[2]!==void 0?2:3,u=nt(a);if(!u.trim())continue;let f=i.index+c+(u.length-u.trimStart().length);t.push({code:u.trim(),line:te(n,f),column:ne(n,f),offset:f,kind:"interpolation"})}let o=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((i=o.exec(n))!==null){let r=i.index+i[0].length-1,a=0,c=r;for(;c<n.length;c++){let h=n[c];if(h==="(")a++;else if(h===")"){if(a--,a===0)break}}if(a!==0)continue;let u=n.slice(r+1,c),f=u.trim();if(o.lastIndex=c+1,!f)continue;let m=r+1+(u.length-u.trimStart().length);t.push({code:f,line:te(n,m),column:ne(n,m),offset:i.index,kind:"condition"})}fe.lastIndex=0;while((i=fe.exec(n))!==null){let r=i[1],a=i[3]??"",c=r.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(Qe.has(c)||Qe.has(r))continue;if(!a.trim())continue;let u=i.index+i[0].indexOf(i[2],i[0].indexOf(r)+r.length)+1;if(st.has(c)){let m=a.match(/\s+(?:in|of)\s+/);if(!m||m.index===void 0)continue;let h=a.slice(m.index+m[0].length),w=m.index+m[0].length+(h.length-h.trimStart().length);t.push({code:Ze(h.trim()),line:te(n,u+w),column:ne(n,u+w),offset:u+w,kind:"directive",attribute:c});continue}let f=a.length-a.trimStart().length;t.push({code:Ze(a.trim()),line:te(n,u+f),column:ne(n,u+f),offset:u+f,kind:"directive",attribute:c})}return t.sort((r,a)=>r.line-a.line||r.column-a.column),t}var on=2000;function an(e,n){let t=0,s=Math.min(e.length,n+on);for(let i=n;i<s;i++){let o=e[i];if(o==="(")t++;else if(o===")"){if(t--,t===0)return e.slice(n+1,i)}}return null}function cn(e){let n=new Map,t=(a,c)=>{let u=a.split(/[,[\]{}()\s]+/).filter(Boolean);for(let f of u){let m=f.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(m))continue;let h=u.length===1?c:void 0,w=n.get(m);if(!w)n.set(m,{name:m,iterable:h});else if(w.iterable!==h)w.iterable=void 0}},s=/^\$?[A-Z_$][\w$]*$/i,i=(a)=>{let c=a.trim();return s.test(c)?c:void 0};for(let a of e.matchAll(/@for(?:each|else)\s*\(/g)){let c=an(e,a.index+a[0].length-1);if(c===null)continue;let u=De(c);if(!u)continue;t(u.itemVar.replace(/=>/g," "),i(u.arrayExpr))}for(let a of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))t(a[1],a[2]==="of"?i(a[3]):void 0);for(let a of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))t(a[1]);let o=ue(e);fe.lastIndex=0;let r;while((r=fe.exec(o))!==null){let a=r[1].replace(/\..*$/,"");if(!st.has(a))continue;let c=r[3].match(/\s+(?:in|of)\s+/);if(!c||c.index===void 0)continue;t(r[3].slice(0,c.index),i(r[3].slice(c.index+c[0].length)))}for(let a of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let c of a[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))t(c[1]);return[...n.values()].sort((a,c)=>a.name.localeCompare(c.name))}function ce(e){let n=new Set;for(let t of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))n.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))n.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))n.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let s of t[1].split(",")){let i=s.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(i))n.add(i)}return[...n].sort()}var Je=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"];function ln(e){let n=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,t=[],s=e.replace(n,(i)=>(t.push(i.trim()),i.split(`
|
|
51
51
|
`).map(()=>"").join(`
|
|
52
52
|
`)));return{imports:t.join(`
|
|
53
|
-
`),body:
|
|
54
|
-
|
|
55
|
-
`)
|
|
56
|
-
`),
|
|
57
|
-
`)})
|
|
58
|
-
`);
|
|
59
|
-
`)
|
|
60
|
-
`))
|
|
61
|
-
`)
|
|
62
|
-
`).
|
|
63
|
-
`)
|
|
53
|
+
`),body:s}}function ot(e){let n=O(e),t=Array(n.length),s=0;for(let a=0;a<n.length;a++){let c=n[a];if(c==="}"||c===")"||c==="]")s=Math.max(0,s-1);if(t[a]=s,c==="{"||c==="("||c==="[")s++}let i=[],o=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,r;while((r=o.exec(n))!==null){if(t[r.index]!==0)continue;let a=r[1],c=r[2],u;if(a==="interface"){let f=n.indexOf("{",r.index);if(f===-1)continue;let m=0;u=-1;for(let h=f;h<n.length;h++)if(n[h]==="{")m++;else if(n[h]==="}"&&--m===0){u=h+1;break}if(u===-1)continue}else{let f=0;u=n.length;for(let m=n.indexOf("=",r.index)+1;m<n.length;m++){let h=n[m];if(h==="{"||h==="["||h==="("||h==="<")f++;else if(h==="}"||h==="]"||h===")"||h===">")f--;else if(f<=0&&(h===";"||h===`
|
|
54
|
+
`&&!/[=|&,<([{]\s*$/.test(n.slice(Math.max(0,m-40),m)))){u=h===";"?m+1:m;break}}}i.push({name:c,text:e.slice(r.index,u).replace(/^[ \t]*export[ \t]+/,"")}),o.lastIndex=u}return i}function un(e){let n=O(e),t=[],s=/^[ \t]*(?:export[ \t]+)?(?:const|let|var)[ \t]+/gm,i,o=0,r=0;while((i=s.exec(n))!==null){for(;r<i.index;r++){let u=n[r];if(u==="{"||u==="("||u==="[")o++;else if(u==="}"||u===")"||u==="]")o=Math.max(0,o-1)}if(o!==0)continue;let a=0,c=n.length;for(let u=i.index+i[0].length;u<n.length;u++){let f=n[u];if(f==="{"||f==="("||f==="[")a++;else if(f==="}"||f===")"||f==="]")a--;else if(a<=0&&(f===";"||f===`
|
|
55
|
+
`)){c=f===";"?u+1:u;break}}if(/\bdefineProps\s*(?:<|\()/.test(n.slice(i.index,c)))t.push(e.slice(i.index,c).replace(/^[ \t]*export[ \t]+/,"").trim())}return t}function fn(e){let n=e.filter((i)=>i.kind==="server").map((i)=>i.code).join(`
|
|
56
|
+
`);if(/\bdefineProps\s*(?:<|\()/.test(O(n)))return n;let t=dn(n),s=e.filter((i)=>i.kind!=="server").flatMap((i)=>{let o=un(i.code);if(!o.length)return[];return[...ot(i.code).filter((r)=>!t.has(r.name)).map((r)=>r.text),...o]});return[n,...s].filter(Boolean).join(`
|
|
57
|
+
`)}function dn(e){return new Set(ot(e).map((n)=>n.name))}var et=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];function at(e){let n=new Set,t=new Set;for(let s of e){let i=s.kind==="server"?n:t;for(let o of ce(s.code))i.add(o)}return[...n].filter((s)=>t.has(s)).sort()}var pn=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function gn(e){let n=new Map,t=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let s of e){let i=O(s),{depths:o,balanced:r}=oe(i);if(!r)continue;let a=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let c of i.matchAll(a)){let u=c.index??0;if(o[u+c[1].length]!==0)continue;let f=c[2],m=u+c[0].length-c[3].length,h=s.slice(m,u+c[0].length).trim().replace(/;$/,"").trim(),w=c[3],C=t.test(w)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(w)&&!/[,+\-*/%&|?:=]$/.test(h)&&oe(w).balanced;n.set(f,n.has(f)||!C?null:h)}}return new Map([...n].filter((s)=>s[1]!==null))}function ct(e,n,t=0,s=new Set){if(n.size===0||t>=5)return e;let i=O(e),o="",r=0;for(let a of i.matchAll(/[A-Za-z_$][\w$]*/g)){let c=a.index??0,u=a[0],f=n.get(u);if(!f||s.has(u))continue;let m=i.slice(0,c).trimEnd(),h=i.slice(c+u.length).trimStart();if(m.endsWith(".")||/^:(?!:)/.test(h)&&/[{,]$/.test(m))continue;if(c>0&&/[\w$]/.test(i[c-1]))continue;o+=`${e.slice(r,c)}(${ct(f,n,t+1,new Set([...s,u]))})`,r=c+u.length}return o+e.slice(r)}function mn(e,n){let t=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,s=[],i;while((i=t.exec(e))!==null){if(i.index>n)break;let o=i[1];if(i.index===n){if(o==="elseif"){let a=s[s.length-1];if(a?.current)a.seen.push(a.current);if(a)a.current=null}break}if(o==="endif"||o==="endunless"){s.pop();continue}let r="";if(i[2]==="("){let a=0,c=i.index+i[0].length-1,u=c+1;for(;c<e.length;c++){let f=e[c];if(f==="(")a++;else if(f===")"){if(a--,a===0)break}}r=e.slice(u,c).trim(),t.lastIndex=c+1}if(o==="if")s.push({seen:[],current:r});else if(o==="unless")s.push({seen:[],current:`!(${r})`});else if(o==="elseif"||o==="else"){let a=s[s.length-1];if(!a)continue;if(a.current)a.seen.push(a.current);a.current=o==="elseif"?r:null}}return s.flatMap((o)=>[...o.seen.map((r)=>`!(${r})`),...o.current?[o.current]:[]]).filter(Boolean)}function hn(e){let n=e.code.trim();if(!n)return null;if(e.attribute?.startsWith("@")){if(pn.test(n))return null;let s=";(($event: any): void => { ";return{text:`${s}${n} });`,prefixLength:s.length}}let t=";void ((";return{text:`${t}${n}));`,prefixLength:t.length}}var xn=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function tt(e,n){return lt(e,n).code}function lt(e,n){let t=new Map;if(!n)return{code:e,columns:t};let s=se(e),i=[],o=0;for(let r of e.matchAll(xn)){let a=r.index,[c,u,f,m]=r,h=be.default.resolve(n,m).replace(/\\/g,"/"),w=`${u}${f}${h}${f}`;if(i.push(e.slice(o,a),w),o=a+c.length,c.includes(`
|
|
58
|
+
`))continue;let C=Y(s,a),v=t.get(C.line)??[],d=v.at(-1),T=C.column+(d?d.generatedEnd-d.sourceEnd:0);v.push({sourceStart:C.column,sourceEnd:C.column+c.length,generatedStart:T,generatedEnd:T+w.length}),t.set(C.line,v)}return i.push(e.slice(o)),{code:i.join(""),columns:t}}function bn(e,n,t){let s=qe(e.importColumns?.get(n)??[],t);return qe(e.scriptColumns?.get(n)??[],s)}function ut(e,n,t){let s=Ye(e.scriptColumns?.get(n)??[],t);return Ye(e.importColumns?.get(n)??[],s)}function Sn(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function yn(e){let n=new Set,t=O(e);for(let s of t.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let i=s[1],o=/\{([^}]*)\}/.exec(i);for(let u of o?.[1].split(",")??[]){let f=u.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(f&&/^[A-Z_$][\w$]*$/i.test(f))n.add(f)}let r=i.replace(/\{[^}]*\}/,""),a=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(r);if(a)n.add(a[1]);let c=/^\s*([A-Z_$][\w$]*)/i.exec(r);if(c&&c[1]!=="type")n.add(c[1])}return[...n].sort()}function ft(e,n={}){let t=le(e),s=e.split(`
|
|
59
|
+
`),i=Array.from({length:s.length},()=>""),o=new Map,r=new Map,a=new Map,c=[],u=fn(t),f=n.filePath&&n.templateExpressions!==!1?He(e,ue(e),{filePath:n.filePath,componentsDir:n.componentsDir,projectRoot:n.projectRoot,readComponent:n.readComponent,scriptCode:(v,d)=>le(v).map((T)=>tt(T.code,be.default.dirname(d))).join(`
|
|
60
|
+
`)}):void 0,m=new Set,h=[];for(let[v,d]of t.entries()){let T=tn(Sn(d)+d.code,u,String(v));for(let[_,y]of T.columns)r.set(d.startLine+_-1,y);for(let _ of T.declarations)c.push({text:tt(_.text,n.originDir??""),origin:_.origin?{..._.origin,line:_.origin.line+d.startLine-1}:void 0});let E=rt(T.code),x=lt(E,n.originDir??"");for(let[_,y]of x.columns)a.set(d.startLine+_-1,y);let A=x.code.split(`
|
|
61
|
+
`);A.forEach((_,y)=>{let D=d.startLine-1+y;if(D<i.length)i[D]=_,m.add(D)}),h.push(d.startLine-1+A.length-1)}for(let v of h){let d=i[v]?.trim()===""?v:v+1;if(d<i.length&&i[d].trim()===""&&(d===v||!m.has(d)))i[d]=";"}let w=(v,d)=>{for(let[T,E]of v.split(`
|
|
62
|
+
`).entries())if(i.push(E),d)o.set(i.length,T===0?d:{...d,line:d.line+T,column:1,prefixLength:0})};for(let v of c)w(v.text,v.origin);if(n.globals!==!1){w("");let v=new Set([...t.flatMap((x)=>ce(x.code)),...t.flatMap((x)=>yn(x.code))]),d=(x)=>{if(!v.has(x))w(`declare var ${x}: any`)};if(n.runtimeGlobals!==!1){if(!v.has("window"))w("declare var window: any");for(let x of Q)d(x)}let T=[...new Set([...Je,...pe,...et])].filter((x)=>n.runtimeGlobals!==!1||!Q.includes(x));if(n.contextScope==="global"){w("declare global {");for(let x of T)w(` var ${x}: any`);w("}")}else{for(let x of Je)d(x);for(let x of pe)d(x);for(let x of et)d(x)}w(`declare var ${xe}: any`);let E=new Set(t.flatMap((x)=>ce(x.code)));w(`type ${Xe}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let x of cn(e)){if(E.has(x.name))continue;let A=x.iterable&&E.has(x.iterable)?`${Xe}<typeof ${x.iterable}>`:"any";w(`declare var ${x.name}: ${A}`)}}if(n.templateExpressions!==!1){if(f?.declarations)for(let d of f.declarations.split(`
|
|
63
|
+
`))w(d);let v=rn(e).map((d)=>{let T=f?.events.get(d.offset??-1);if(T){d.anchor=!0;let E=d.code.trim(),x=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(E),A=x?`void ((${x[2]}) satisfies __StxAssignedValue<typeof ${x[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(E)?`${E} satisfies (($event: ${T}) => unknown)`:E,_=`;(($event: ${T}): void => { `;return{expression:d,statement:{text:`${_}${A} });`,prefixLength:_.length}}}return{expression:d,statement:hn(d)}}).filter((d)=>d.statement!==null);if(v.push(...f?.checks||[]),v.length>0){let d=ue(e),T=Ge(d),E=gn(t.map((y)=>y.code)),A=[...new Set(t.flatMap((y)=>ce(y.code)))].filter((y)=>/^[A-Z_$][\w$]*$/i.test(y)),_=0;if(A.length>0){w(Jt);for(let y of A)w(`function __StxRead_${y}() { return ${y} }`),w(`type __StxT_${y} = ${it}<ReturnType<typeof __StxRead_${y}>>`);w(`;((${A.map((y)=>`${y}: __StxT_${y}`).join(", ")}) => {`),_=1}for(let{expression:y,statement:D}of v){let N=" ".repeat(_),P=y.offset===void 0?[]:T.filter((V)=>y.offset>=V.start&&y.offset<V.end),M=P.map((V)=>`;((${V.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),F=" });".repeat(P.length),j=y.offset===void 0?[]:mn(d,y.offset),K=j.length>0?`${j.map((V)=>`if (${ct(V,E)}) `).join("")}{ `:"",W=j.length>0?" }":"";w(N+M+K+D.text+W+F,{line:y.line,column:y.column,expression:y,prefixLength:D.prefixLength+N.length+M.length+K.length,guardPrefixLength:N.length+M.length+K.length})}if(_>0)w("});")}}let C=!1;if(n.reference&&i[0]!==void 0&&i[0].trim()==="")i[0]=`/// <reference path=${JSON.stringify(n.reference.replace(/\\/g,"/"))} />`,C=!0;return w("export {}"),{text:i.join(`
|
|
64
|
+
`),lineMap:o,sourceLineCount:s.length,componentDependencies:f?.dependencies,referenced:C,scriptColumns:r,importColumns:a}}function se(e){let n=[0];for(let t=0;t<e.length;t++)if(e.charCodeAt(t)===10)n.push(t+1);return n}function Y(e,n){let t=0,s=e.length-1;while(t<s){let i=Math.ceil((t+s)/2);if(e[i]<=n)t=i;else s=i-1}return{line:t+1,column:n-e[t]+1}}function de(e,n,t){let s=Math.min(Math.max(n,1),e.length)-1,i=s+1<e.length?e[s+1]-1:Number.MAX_SAFE_INTEGER;return Math.min(e[s]+Math.max(t,1)-1,i)}function dt(e,n){if(!e.expression)return!1;return e.inGuard===!0||n===2774}function pt(e,n,t){let s=e.lineMap.get(n);if(!s)return n<=e.sourceLineCount?{line:n,column:bn(e,n,t)}:null;let i=s.expression?.anchor?0:Math.max(0,t-1-(s.prefixLength??0));return{line:s.line,column:s.column+i,expression:s.expression,inGuard:t<=(s.guardPrefixLength??0)}}var gt=["module","exports","require","props","$props","$bool","$num","defineProps","withDefaults","defineClientPayload","useServerData","useRuntimeConfig","useServerRuntimeConfig","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"];var wn=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),ht=gt.filter((e)=>!wn.has(e)).sort(),xt=[...Q].sort(),vn=[...new Set([...ht,...xt])].sort(),Tn=new Set(ht),En=new Set(xt),$n=new Set(vn),mt=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Cn(e,n){if(n==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function bt(e,n){let t=[];for(let s of n){if(s.offset===void 0)continue;let i=s.kind==="server"?Tn:En;mt.lastIndex=0;for(let o of s.code.matchAll(mt)){let r=o.index+o[0].indexOf("{")+1;for(let a of o[1].matchAll(/[^,]+/g)){let c=a[0];if(/^\s*type\s/.test(c))continue;let u=/^\s*([A-Za-z_$][\w$]*)/.exec(c);if(!u)continue;let f=u[1];if(!$n.has(f)||i.has(f))continue;let m=s.offset+r+a.index+u[0].length-f.length,h=e.slice(0,m),w=h.split(`
|
|
65
|
+
`).length;t.push({line:w,column:m-(h.lastIndexOf(`
|
|
66
|
+
`)+1)+1,offset:m,length:f.length,name:f,kind:s.kind,message:Cn(f,s.kind)})}}}return t}var U=X(require("node:path"),1),_n="@stacksjs/stx-typescript-plugin";function kn(e,n){let t=U.default.resolve(e);for(;;){let s=U.default.join(t,"tsconfig.json");if(n(s))return s;let i=U.default.dirname(t);if(i===t)return;t=i}}function St(e,n,t){let s=kn(e,t);if(!s)return;let i=new Set,o=(r)=>{if(i.has(r))return;i.add(r);let a=n(r);if(!a)return;let c=a.compilerOptions?.plugins;if(Array.isArray(c)){let f=c.find((h)=>h?.name===_n),m=Array.isArray(f?.libs)?f.libs.filter((h)=>typeof h==="string"):[];return f?{configPath:r,libs:m.map((h)=>U.default.resolve(U.default.dirname(r),h))}:null}let u=typeof a.extends==="string"?[a.extends]:Array.isArray(a.extends)?a.extends:[];for(let f of[...u].reverse()){if(typeof f!=="string"||!f.startsWith("."))continue;let m=U.default.resolve(U.default.dirname(r),f.endsWith(".json")?f:`${f}.json`),h=o(m);if(h!==void 0)return h}return};return o(s)??void 0}var yt=Symbol.for("@stacksjs/stx-typescript-plugin"),An=new Set([2300,2451,2403]);function ie(e){return e.endsWith(".stx")}function wt(e){return ie(e)||e.endsWith(".md")}function Rn(e){if(!e)return;return z.existsSync(B.default.join(e,"stx-module.d.ts"))&&z.existsSync(B.default.join(e,"stx.d.ts"))?B.default.join(e,"stx-module.d.ts"):void 0}function Pn(e,n=z.existsSync){let t=e;for(;;){let s=B.default.join(t,"node_modules","@stacksjs","stx","stx-module.d.ts");if(n(s))return s;let i=B.default.dirname(t);if(i===t)return;t=i}}function Dn(e,n=B.default.join(Tt.tmpdir(),"stx-typescript-plugin")){let t=e.map((i)=>`/// <reference path=${JSON.stringify(i.replace(/\\/g,"/"))} />`).join(`
|
|
64
67
|
`)+`
|
|
65
|
-
`,
|
|
68
|
+
`,s=B.default.join(n,`${vt.createHash("sha1").update(t).digest("hex").slice(0,16)}.d.ts`);if(!z.existsSync(s))z.mkdirSync(n,{recursive:!0}),z.writeFileSync(s,t);return s}function Mn(e,n,t,s){let i=(a)=>ft(n,{templateExpressions:ie(e),originDir:B.default.dirname(e),filePath:e,readComponent:s.readComponent,componentsDir:s.componentsDir,projectRoot:s.projectRoot,reference:a,runtimeGlobals:!a,contextScope:"global"}),o=i(s.declarations);if(s.declarations&&!o.referenced)o=i(void 0);let r=le(n);return{version:t,source:n,virtual:o,blocks:r,sourceStarts:se(n),virtualStarts:se(o.text),collisions:new Set(at(r))}}function In(e,n){let t=e.findConfigFile(n,e.sys.fileExists);if(!t)return;let s=e.readConfigFile(t,e.sys.readFile);if(s.error)return;let i=e.parseJsonConfigFileContent(s.config,e.sys,B.default.dirname(t),void 0,t),o={};if(i.options.types)o.types=i.options.types;let r=i.options.paths;if(r){let a=i.options.baseUrl??i.options.pathsBasePath??B.default.dirname(t);o.paths={};for(let[c,u]of Object.entries(r))o.paths[c]=u.map((f)=>B.default.isAbsolute(f)?f:B.default.resolve(a,f))}return o}function Ln(e,n={}){let t=e.typescript,s={},i=new Set,o=new WeakSet;return{create(r){let a=(l)=>{r.project.projectService.logger.info(`[stx-plugin] ${l}`)};if(r.languageService[yt])return o.add(r.project),a("already applied to this project by another registration of the plugin; leaving it as it is"),r.languageService;a("TypeScript stx plugin initialized");let{languageService:c,languageServiceHost:u}=r,f=(l)=>{let g=c[l];return typeof g==="function"?g.bind(c):()=>{return}},m=u.getScriptSnapshot?.bind(u),h=u.getScriptVersion?.bind(u),w=Rn(n.declarationsDir);if(!w)a("the bundled stx declarations were not found; apps without their own fall back to `any`");let C=(l)=>t.sys?.fileExists(l)??z.existsSync(l),v=(l)=>{let g=t.readConfigFile?.(l,(p)=>t.sys.readFile(p));return g&&!g.error?g.config:void 0},d=new Map,T=(l)=>{let g=B.default.dirname(l);if(!d.has(g)){let p=Pn(g,C)??w,S=[];try{S=(St(g,v,C)?.libs??[]).filter(C)}catch(b){a(`could not read the stx entry of the project's tsconfig: ${String(b)}`)}d.set(g,p&&S.length>0?Dn([p,...S]):p)}return d.get(g)},E=new Map,x=(l)=>{let g=m?.(l);return g?g.getText(0,g.getLength()):t.sys?.readFile(l)},A=()=>s.enabled!==!1;i.add(()=>{E.clear(),r.project.refreshDiagnostics?.()});let _=(l)=>{if(!wt(l)||!m)return;let g=`${h?.(l)||"0"}:${u.getProjectVersion?.()||""}`,p=E.get(l);if(p&&p.version===g&&[...p.virtual.componentDependencies||[]].every(([b,k])=>x(b)===k))return p;let S=m(l);if(!S)return;try{let b=r.project.getCurrentDirectory?.(),k=b?B.default.resolve(b,typeof r.config?.componentsDir==="string"?r.config.componentsDir:"components"):void 0,I=Mn(l,S.getText(0,S.getLength()),g,{declarations:T(l),readComponent:x,componentsDir:k,projectRoot:b});return E.set(l,I),I}catch(b){a(`failed to build virtual document for ${l}: ${String(b)}`);return}},y=(l)=>ie(l)?_(l):void 0,D=(l,g)=>{let p=Y(l.virtualStarts,g);return pt(l.virtual,p.line,p.column)},N=(l,g)=>{let p=D(l,g);if(!p)return;return de(l.sourceStarts,p.line,p.column)},P=(l,g)=>{let p=Y(l.sourceStarts,g);return de(l.virtualStarts,p.line,ut(l.virtual,p.line,p.column))},M=(l,g)=>{let p=N(l,g.start);if(p===void 0)return;let S=N(l,g.start+g.length);return{start:p,length:S!==void 0&&S>=p?S-p:g.length}},F=(l,g)=>l.blocks.some((p)=>p.offset!==void 0&&g>=p.offset&&g<=p.offset+p.code.length),j=(l)=>{let g=y(l.fileName);if(!g)return l;let p=M(g,l.textSpan);if(!p)return;let S=l.contextSpan?M(g,l.contextSpan):void 0;return{...l,textSpan:p,contextSpan:S}},K=(l)=>l?.map(j).filter((g)=>g!==void 0),W=(l)=>l?.filter((g)=>{let p=y(g.fileName);if(!p)return!0;let{line:S}=Y(p.virtualStarts,g.textSpan.start);return S<=p.virtual.sourceLineCount&&!p.virtual.lineMap.has(S)});if(m)u.getScriptSnapshot=(l)=>{let g=_(l);if(g)return t.ScriptSnapshot.fromString(g.virtual.text);return m(l)};let V=u.getCompilationSettings?.bind(u),re=t.server?.ProjectKind!==void 0&&r.project.projectKind===t.server.ProjectKind.Inferred;if(V&&re){let l=null,g;u.getCompilationSettings=()=>{let p=V();if(l===null)try{l=In(t,r.project.getCurrentDirectory())}catch(S){a(`could not read the project's tsconfig: ${String(S)}`),l=void 0}if(!l)return p;if(g?.from!==p)g={from:p,options:{...p,...l.paths&&!p.paths?{paths:l.paths}:{},...l.types&&!p.types?{types:l.types}:{}}};return g.options}}let H=(l,g)=>{let p=_(l);if(!p)return g;if(ie(l)&&!A())return[];let S=[];for(let b of g){let k=typeof b.messageText==="string"?b.messageText:b.messageText.messageText;if(An.has(b.code)){let G=k.match(/'([^']+)'/)?.[1];if(G&&p.collisions.has(G))continue}if(b.start===void 0){S.push(b);continue}let I=D(p,b.start);if(!I||dt(I,b.code))continue;let L=de(p.sourceStarts,I.line,I.column),ee=N(p,b.start+(b.length??0));S.push({...b,start:L,length:ee!==void 0&&ee>L?ee-L:b.length??0})}return S},$t=f("getSemanticDiagnostics");c.getSemanticDiagnostics=(l)=>{let g=H(l,$t(l)),p=y(l);if(!p||!A())return g;let S=c.getProgram?.()?.getSourceFile(l);for(let b of bt(p.source,p.blocks))g.push({file:S,start:b.offset,length:b.length,messageText:b.message,category:t.DiagnosticCategory?.Error??1,code:0,source:"stx"});return g};let Ct=f("getSyntacticDiagnostics");c.getSyntacticDiagnostics=(l)=>H(l,Ct(l));let _t=f("getSuggestionDiagnostics");c.getSuggestionDiagnostics=(l)=>H(l,_t(l));let Se=f("getQuickInfoAtPosition");c.getQuickInfoAtPosition=(l,g,...p)=>{let S=y(l);if(!S)return Se(l,g,...p);if(!A())return;let b=Se(l,P(S,g),...p);if(!b)return b;let k=M(S,b.textSpan);return k?{...b,textSpan:k}:void 0};let ye=f("getCompletionsAtPosition");c.getCompletionsAtPosition=(l,g,p,...S)=>{let b=y(l);if(!b)return ye(l,g,p,...S);if(!A()||!F(b,g))return;let k=ye(l,P(b,g),{...p,includeCompletionsForModuleExports:!1},...S);if(!k)return k;let I=(L)=>L&&M(b,L);return{...k,optionalReplacementSpan:I(k.optionalReplacementSpan),entries:k.entries.filter((L)=>!L.name.startsWith("__stx")&&!L.name.startsWith("__Stx")).map((L)=>L.replacementSpan?{...L,replacementSpan:I(L.replacementSpan)}:L)}};let we=f("getCompletionEntryDetails");c.getCompletionEntryDetails=(l,g,...p)=>{let S=y(l);if(!S)return we(l,g,...p);let b=we(l,P(S,g),...p);return b?{...b,codeActions:void 0}:b};let ve=f("getSignatureHelpItems");c.getSignatureHelpItems=(l,g,...p)=>{let S=y(l);if(!S)return ve(l,g,...p);if(!A()||!F(S,g))return;let b=ve(l,P(S,g),...p),k=b&&M(S,b.applicableSpan);return b&&k?{...b,applicableSpan:k}:void 0};let Te=f("getDefinitionAndBoundSpan");c.getDefinitionAndBoundSpan=(l,g)=>{let p=y(l);if(!p)return Ee(Te(l,g));if(!A())return;let S=Te(l,P(p,g)),b=S&&M(p,S.textSpan);return S&&b?{...Ee(S),textSpan:b}:void 0};let Ee=(l)=>l&&{...l,definitions:W(l.definitions)};for(let l of["getDefinitionAtPosition","getTypeDefinitionAtPosition","getImplementationAtPosition"]){let g=f(l);c[l]=(p,S,...b)=>{let k=y(p);if(k&&!A())return;return W(g(p,k?P(k,S):S,...b))}}for(let l of["getReferencesAtPosition"]){let g=f(l);c[l]=(p,S,...b)=>{let k=y(p);if(k&&!A())return;return K(g(p,k?P(k,S):S,...b))}}let kt=f("findReferences");c.findReferences=(l,g)=>{let p=y(l);if(p&&!A())return;return kt(l,p?P(p,g):g)?.map((S)=>{let b=j(S.definition);return b?{definition:b,references:K(S.references)}:void 0}).filter((S)=>S!==void 0)};let At=f("getDocumentHighlights");c.getDocumentHighlights=(l,g,p)=>{let S=y(l);if(S&&(!A()||!F(S,g)))return;return At(l,S?P(S,g):g,p)?.map((b)=>{let k=y(b.fileName);if(!k)return b;return{...b,highlightSpans:b.highlightSpans.map((I)=>{let L=M(k,I.textSpan);return L?{...I,textSpan:L,contextSpan:I.contextSpan&&M(k,I.contextSpan)}:void 0}).filter((I)=>I!==void 0)}})};let Rt=f("getNavigationTree");c.getNavigationTree=(l)=>{let g=Rt(l),p=y(l);if(!p)return g;let S=(k)=>{let I=k.spans.map((G)=>M(p,G)).filter((G)=>G!==void 0);if(I.length===0)return;let L=k.nameSpan&&M(p,k.nameSpan),ee=k.childItems?.map(S).filter((G)=>G!==void 0);return{...k,spans:I,nameSpan:L,childItems:ee}},b={...g,spans:[{start:0,length:p.source.length}]};return A()?{...b,childItems:g.childItems?.map(S).filter((k)=>k!==void 0)}:{...b,childItems:[]}};let Pt={getEncodedSemanticClassifications:()=>{return},getEncodedSyntacticClassifications:()=>{return},getSemanticClassifications:()=>[],getSyntacticClassifications:()=>[],getFormattingEditsForDocument:()=>[],getFormattingEditsForRange:()=>[],getFormattingEditsAfterKeystroke:()=>[],getNavigationBarItems:()=>[],getOutliningSpans:()=>[],getBraceMatchingAtPosition:()=>[],getTodoComments:()=>[],getDocCommentTemplateAtPosition:()=>{return},getJsxClosingTagAtPosition:()=>{return},getLinkedEditingRangeAtPosition:()=>{return},getSpanOfEnclosingComment:()=>{return},getCodeFixesAtPosition:()=>[],getApplicableRefactors:()=>[],getEditsForRefactor:()=>{return},getRenameInfo:()=>({canRename:!1,localizedErrorMessage:"Rename is not supported in .stx files."}),findRenameLocations:()=>{return},provideInlayHints:()=>[],prepareCallHierarchy:()=>{return},provideCallHierarchyIncomingCalls:()=>[],provideCallHierarchyOutgoingCalls:()=>[],getFileReferences:()=>[]};for(let[l,g]of Object.entries(Pt)){let p=c[l];if(typeof p!=="function")continue;let S=p.bind(c);c[l]=(b,...k)=>typeof b==="string"&&ie(b)?g():S(b,...k)}return c[yt]=!0,a("Language service proxy created"),c},getExternalFiles(r){if(o.has(r))return[];return r.getFileNames().filter(wt)},onConfigurationChanged(r){s={...s,...r};for(let a of i)a()}}}var Et=Ln;module.exports=Et;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx-vscode",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.850",
|
|
5
5
|
"description": "stx language support for VS Code extensions to embed: the hovers, completions, diagnostics, grammar, snippets, language configuration and TypeScript server plugin behind the stx extension.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|