sveld 0.36.9 → 0.36.10
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/lib/browser.js +140 -194
- package/lib/chunk-0204rbr9.js +7 -0
- package/lib/chunk-2nrjrvnn.js +1 -0
- package/lib/{chunk-mdth9bg3.js → chunk-c83445g5.js} +3 -3
- package/lib/chunk-d802cqsd.js +7 -0
- package/lib/{chunk-hpxd4cgm.js → chunk-n9w94djt.js} +1 -1
- package/lib/{chunk-yzabyfqs.js → chunk-py1s51tb.js} +10 -10
- package/lib/cli-entry.js +1 -1
- package/lib/index.d.ts +1 -824
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/lib/chunk-0beysrt7.js +0 -62
- package/lib/chunk-cqkng6ys.js +0 -7
- package/lib/chunk-n5cjh6db.js +0 -1
package/lib/chunk-cqkng6ys.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{$ as gt,A as _,B as K,C as _e,E as Ce,H as pt,I as Y,J as lt,K as N,L as J,M as dt,N as oe,O as ie,P as Ve,R as ut,S as mt,T as ft,U as yt,V as Oe,W as $e,X as Ge,Y as fe,Z as Ke,_ as Je,ba as Tt,ca as ze,da as Ze,ea as bt,fa as xt,ga as De,ha as et,ja as tt,ka as z,la as We,ma as ht,u as B,w as we,x as st,y as Te,z as ct}from"./chunk-yzabyfqs.js";import{oa as St}from"./chunk-0beysrt7.js";var ke={a:"HTMLAnchorElement",abbr:"HTMLElement",address:"HTMLElement",applet:"HTMLUnknownElement",area:"HTMLAreaElement",article:"HTMLElement",aside:"HTMLElement",audio:"HTMLAudioElement",b:"HTMLElement",base:"HTMLBaseElement",basefont:"HTMLElement",bdi:"HTMLElement",bdo:"HTMLElement",blockquote:"HTMLQuoteElement",body:"HTMLBodyElement",br:"HTMLBRElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",caption:"HTMLTableCaptionElement",cite:"HTMLElement",code:"HTMLElement",col:"HTMLTableColElement",colgroup:"HTMLTableColElement",data:"HTMLDataElement",datalist:"HTMLDataListElement",dd:"HTMLElement",del:"HTMLModElement",details:"HTMLDetailsElement",dfn:"HTMLElement",dialog:"HTMLDialogElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",dl:"HTMLDListElement",dt:"HTMLElement",em:"HTMLElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",figcaption:"HTMLElement",figure:"HTMLElement",font:"HTMLFontElement",footer:"HTMLElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",h1:"HTMLHeadingElement",h2:"HTMLHeadingElement",h3:"HTMLHeadingElement",h4:"HTMLHeadingElement",h5:"HTMLHeadingElement",h6:"HTMLHeadingElement",head:"HTMLHeadElement",header:"HTMLElement",hgroup:"HTMLElement",hr:"HTMLHRElement",html:"HTMLHtmlElement",i:"HTMLElement",iframe:"HTMLIFrameElement",img:"HTMLImageElement",input:"HTMLInputElement",ins:"HTMLModElement",kbd:"HTMLElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",li:"HTMLLIElement",link:"HTMLLinkElement",main:"HTMLElement",map:"HTMLMapElement",mark:"HTMLElement",marquee:"HTMLMarqueeElement",menu:"HTMLMenuElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",nav:"HTMLElement",noscript:"HTMLElement",object:"HTMLObjectElement",ol:"HTMLOListElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",picture:"HTMLPictureElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",rp:"HTMLElement",rt:"HTMLElement",ruby:"HTMLElement",s:"HTMLElement",samp:"HTMLElement",script:"HTMLScriptElement",search:"HTMLElement",section:"HTMLElement",select:"HTMLSelectElement",slot:"HTMLSlotElement",small:"HTMLElement",source:"HTMLSourceElement",span:"HTMLSpanElement",strong:"HTMLElement",style:"HTMLStyleElement",sub:"HTMLElement",summary:"HTMLElement",sup:"HTMLElement",table:"HTMLTableElement",tbody:"HTMLTableSectionElement",td:"HTMLTableCellElement",template:"HTMLTemplateElement",textarea:"HTMLTextAreaElement",tfoot:"HTMLTableSectionElement",th:"HTMLTableCellElement",thead:"HTMLTableSectionElement",time:"HTMLTimeElement",title:"HTMLTitleElement",tr:"HTMLTableRowElement",track:"HTMLTrackElement",u:"HTMLElement",ul:"HTMLUListElement",var:"HTMLElement",video:"HTMLVideoElement",wbr:"HTMLElement"};function Pt(e){return e in ke}function Le(e){if(Pt(e))return ke[e];return"HTMLElement"}function Se(){return{syntaxMode:"legacy",scriptLanguage:void 0,source:void 0,parsed:void 0,runesOptionOverride:void 0,sourceLineStartOffsetsCache:void 0,rest_props:void 0,extends:void 0,customElementTag:void 0,componentComment:void 0,componentCommentSource:void 0,generics:null,scriptGenericsAttribute:void 0,diagnosticRecords:[],componentFilePath:"",props:new Map,moduleExports:new Map,propLocalToPublicName:new Map,reactive_vars:new Set,funcDecls:new Map,vars:new Set,valueImportBindingsByLocalName:new Map,pendingCallDefaultCandidates:[],pendingContextKeyCandidates:[],runesPropsDeclarationMetadataByDeclaratorStart:new Map,typedRunesPropsDeclarations:[],explicitPropTypesByName:new Map,explicitVariableTypesByName:new Map,typeImportBindingsByLocalName:new Map,localTypeDeclarationsByName:new Map,wholePropsLocals:new Set,restPropLocals:new Set,componentScope:new Map,scopeDeclarations:new WeakMap,activeScopes:[],slots:new Map,snippetPropLocals:new Set,deferredSlotBlockGenerics:[],events:new Map,eventDescriptions:new Map,forwardedEvents:new Map,jsDocEventNames:new Set,jsDocEventSources:new Map,bindings:new Map,contexts:new Map,typedefs:new Map,variableInfoCache:new Map,variableInfoCacheBuilt:!1}}function Et({hasTypeScriptType:e,hasJSDocType:t,inferredType:n,finalType:r}){if(e)return"typescript";if(t)return"jsdoc";if(n!==void 0)return"default";if(r!==void 0)return"inferred";return"unknown"}function ne(e){let t=e.explicitType??e.jsdocType??e.resolvedType??e.typeSeed,n=e.jsdocParams??e.resolvedParams,r=e.jsdocReturnType??e.resolvedReturnType;if(e.isFunctionDeclaration&&t==="() => any"&&r)t=n&&n.length>0?`(${n.map((p)=>`${p.name}${p.optional?"?":""}: ${p.type}`).join(", ")}) => ${r}`:`() => ${r}`;let i=e.jsdocDescription??e.resolvedDescription;if(i===void 0&&t!==void 0)i=e.typedefs?.get(t)?.description;let c=Et({hasTypeScriptType:e.explicitType!==void 0,hasJSDocType:e.jsdocType!==void 0||e.jsdocParams!==void 0||e.jsdocReturnType!==void 0||e.resolvedType!==void 0,inferredType:e.inferredTypeForSource,finalType:t}),s=e.initializerIsFunction||e.isFunctionDeclaration||e.inferIsFunctionFromTypeSignature===!0&&(!!e.jsdocParams?.length||e.jsdocReturnType!==void 0||!!e.jsdocType?.includes("=>")||!!e.resolvedType?.includes("=>")||!!e.explicitType?.includes("=>"));return{type:t,typeSource:c,description:i,params:n,returnType:r,isFunction:s}}function vt(e){if(!e||typeof e!=="object"||!("type"in e))return;let t=String(e.type);if(t!=="InlineComponent"&&t!=="Element")return;let n="name"in e&&typeof e.name==="string"?e.name:void 0;if(!n)return;let r=t==="InlineComponent"?{type:"InlineComponent",name:n}:{type:"Element",name:n};if(t==="Element"&&n==="svelte:element"&&"tag"in e&&typeof e.tag==="string")r.thisValue=e.tag;return r}function Ne(e,t){if(e.rest_props!==void 0)return;let n=vt(t);if(n)e.rest_props=n}function C(e,t,n){if(!t||e.has(t))return;e.set(t,n)}function de(e,t){for(let n=e.activeScopes.length-1;n>=0;n-=1){let r=e.activeScopes[n]?.get(t);if(!r)continue;return r.kind==="prop"?r.publicPropName:void 0}return}function E(e,t=new Set){if(!e||typeof e!=="object"||!("type"in e))return t;switch(e.type){case"Identifier":t.add(e.name);break;case"AssignmentPattern":E(e.left,t);break;case"ArrayPattern":for(let n of e.elements)E(n??void 0,t);break;case"ObjectPattern":for(let n of e.properties)if(n.type==="Property")E(n.value,t);else if(n.type==="RestElement")E(n.argument,t);break;case"RestElement":E(e.argument,t);break}return t}function Ee(e,t){let n=E(t);if(!n)return;for(let r of n){let i=de(e,r);if(i)e.reactive_vars.add(i)}}function ue(e){if(!e||typeof e!=="object"||!("type"in e))return!1;switch(String(e.type)){case"BlockStatement":case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"CatchClause":case"EachBlock":case"ThenBlock":case"CatchBlock":return!0;default:return!1}}function Re(e){if(!e||typeof e!=="object"||!("type"in e))return!1;let t=String(e.type);return t==="FunctionDeclaration"||t==="FunctionExpression"||t==="ArrowFunctionExpression"}function Mt(e,t){let n=e.scopeDeclarations.get(t);if(!n)n=new Map,e.scopeDeclarations.set(t,n);return n}function Dt(e,t,n){let r=[];if(n.id.type==="Identifier")return r.push({kind:"local",name:n.id.name}),r;if(n.id.type!=="ObjectPattern")return r;for(let i of n.id.properties){if(i.type==="RestElement"){if(i.argument.type==="Identifier")r.push({kind:"local",name:i.argument.name});continue}if(i.computed)continue;let c=e.getPropertyName(i.key);if(!c)continue;let s;if(i.value.type==="Identifier")s=i.value.name;else if(i.value.type==="AssignmentPattern"&&i.value.left.type==="Identifier")s=i.value.left.name;if(!s)continue;r.push({kind:"prop",name:s,publicPropName:c})}return r}function Pe(e,t,n,r,i){if(!we(t))return;let c=i?.allowRunesProps??!1,s=i?.forceProp??!1,p=t;for(let d of p.declarations){if(c&&_(K(d.init),"$props")){for(let T of Dt(e,p,d))C(T.kind==="prop"?n:r,T.name,T.kind==="prop"?{kind:"prop",publicPropName:T.publicPropName}:{kind:"local"});continue}let f=p.kind==="var"?r:n,y=s?"prop":"local";for(let T of E(d.id))C(f,T,y==="prop"?{kind:"prop",publicPropName:T}:{kind:"local"})}}function Ct(e,t){if("id"in e&&e.id&&typeof e.id==="object"&&"name"in e.id&&typeof e.id.name==="string")C(t,e.id.name,{kind:"local"});for(let n of e.params)for(let r of E(n))C(t,r,{kind:"local"})}function kt(e,t,n,r){if(!Array.isArray(t))return;for(let i of t){if(!i||typeof i!=="object"||!("type"in i))continue;switch(i.type){case"VariableDeclaration":Pe(e,i,n,r);break;case"FunctionDeclaration":if(i.id?.name)C(n,i.id.name,{kind:"local"});break;case"ClassDeclaration":if(i.id?.name)C(n,i.id.name,{kind:"local"});break}}}function Lt(e,t,n){if(!n||typeof n!=="object")return;let r="content"in n&&n.content&&typeof n.content==="object"&&"body"in n.content&&Array.isArray(n.content.body)?n.content:("body"in n)&&Array.isArray(n.body)?n:void 0;if(!r||!("body"in r)||!Array.isArray(r.body))return;for(let i of r.body){if(!i||typeof i!=="object"||!("type"in i))continue;switch(i.type){case"ImportDeclaration":for(let c of i.specifiers??[])if(c.local?.name)C(t.componentScope,c.local.name,{kind:"local"});break;case"VariableDeclaration":Pe(e,i,t.componentScope,t.componentScope,{allowRunesProps:!0});break;case"FunctionDeclaration":if(i.id?.name)C(t.componentScope,i.id.name,{kind:"local"});break;case"ClassDeclaration":if(i.id?.name)C(t.componentScope,i.id.name,{kind:"local"});break;case"ExportNamedDeclaration":if(!i.declaration||typeof i.declaration!=="object"||!("type"in i.declaration))break;if(i.declaration.type==="VariableDeclaration")Pe(e,i.declaration,t.componentScope,t.componentScope,{forceProp:!0});else if(i.declaration.type==="FunctionDeclaration"&&i.declaration.id?.name)C(t.componentScope,i.declaration.id.name,{kind:"prop",publicPropName:i.declaration.id.name});break}}}function Ie(e,t){t.componentScope.clear(),t.scopeDeclarations=new WeakMap,t.activeScopes.length=0,Lt(e,t,t.parsed?.instance)}function Ae(e){return{varScopeStack:[e.componentScope]}}function He(e,t,n,r){if(!ue(r))return;let i=Mt(t,r),c=n.varScopeStack[n.varScopeStack.length-1]??t.componentScope;switch(String(r.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":Ct(r,i);break;case"BlockStatement":kt(e,r.body,i,c);break;case"CatchClause":if("param"in r)for(let p of E(r.param))C(i,p,{kind:"local"});break;case"EachBlock":{let p=r;for(let d of E(p.context))C(i,d,{kind:"local"});if(typeof p.index==="string")C(i,p.index,{kind:"local"});else if(p.index&&"name"in p.index)C(i,p.index.name,{kind:"local"});break}case"ThenBlock":if("value"in r)for(let p of E(r.value))C(i,p,{kind:"local"});break;case"CatchBlock":if("error"in r)for(let p of E(r.error))C(i,p,{kind:"local"});break}if(Re(r))n.varScopeStack.push(i)}function je(e,t){if(Re(t))e.varScopeStack.pop()}var Nt=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]);function wt(e,t){switch(t?.type){case"MemberExpression":return t.computed||e===t.object;case"MethodDefinition":return!!t.computed;case"MetaProperty":return e===t.meta;case"PropertyDefinition":return t.computed||e===t.value;case"Property":return t.computed||e===t.value;case"ExportSpecifier":case"ImportSpecifier":return e===t.local;case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return!1;default:return!0}}function Rt(e,t){for(let n=t.length-1;n>=0;n-=1)if(t[n]?.has(e))return!0;return!1}function It(e){let t=new Set;if(!e||typeof e!=="object"||!("type"in e))return t;switch(String(e.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":{let n=e;if(n.id?.name)t.add(n.id.name);for(let r of n.params??[])E(r,t);break}case"BlockStatement":me(e.body,t);break;case"CatchClause":E(e.param,t);break;case"EachBlock":{let n=e;if(E(n.context,t),typeof n.index==="string")t.add(n.index);else if(n.index?.name)t.add(n.index.name);break}case"ThenBlock":E(e.value,t);break;case"CatchBlock":E(e.error,t);break}return t}function me(e,t){if(!Array.isArray(e))return;for(let n of e){if(!n||typeof n!=="object"||!("type"in n))continue;switch(String(n.type)){case"ImportDeclaration":for(let r of n.specifiers??[])if(r.local?.name)t.add(r.local.name);break;case"VariableDeclaration":for(let r of n.declarations??[])E(r.id,t);break;case"FunctionDeclaration":case"ClassDeclaration":{let r=n.id?.name;if(r)t.add(r);break}case"ExportNamedDeclaration":{let r=n.declaration;if(r&&typeof r==="object"&&"type"in r)me([r],t);break}}}}function ve(e,t){if(!e||typeof e!=="object")return!1;let n=[...t],r=!1;return B(e,{enter(i,c){if(r){this.skip();return}if(ue(i))n.push(It(i));if(c&&i.type==="Identifier"&&Nt.has(i.name)&&!c.type.startsWith("TS")&&wt(i,c)&&!Rt(i.name,n))r=!0,this.skip()},leave(i){if(ue(i))n.pop()}}),r}function Fe(e){if(!e||typeof e!=="object")return;if("content"in e){let t=e.content,n=t&&typeof t==="object"&&"body"in t?t.body:void 0;if(Array.isArray(n))return n}if("body"in e&&Array.isArray(e.body))return e.body;return}function Be(e){if(e.runesOptionOverride!==void 0)return e.runesOptionOverride?"runes":"legacy";let t=e.parsed;if(!t)return"legacy";let n=new Set;me(Fe(t.module),n);let r=new Set;return me(Fe(t.instance),r),ve(t.module,[n])||ve(t.instance,[n,r])||ve(t.html,[n,r])?"runes":"legacy"}var At=/[A-Za-z_$][\w$]*/g;function Ht(e,t,n){let r=new Map,i=t.typeParameters?.params,c=n.typeArguments?.params;if(!i?.length||!c?.length)return r;for(let s=0;s<i.length;s++){let p=i[s]?.name,d=c[s];if(!p||d?.start===void 0||d?.end===void 0)continue;let f=J(e,d.start,d.end)?.trim();if(f)r.set(p,f)}return r}function jt(e,t){if(t.size===0)return e;return e.replace(At,(n)=>t.get(n)??n)}function re(e,t,n,r,i=new Set){let c=new Map;if(!n?.type)return c;let s=(p)=>{for(let d of p){if(d?.type!=="TSPropertySignature"||d.computed)continue;if(!d.key)continue;let f=e.getPropertyName(d.key);if(!f)continue;let y=d.typeAnnotation?.start,T=d.typeAnnotation?.end;if(y===void 0||T===void 0)continue;let M=J(t,y+1,T)?.trim();if(!M)continue;c.set(f,{type:M,optional:d.optional===!0,source:N(t,d)})}};switch(n.type){case"TSTypeLiteral":s(n.members??[]);break;case"TSInterfaceDeclaration":s(n.body?.body??[]);break;case"TSTypeAliasDeclaration":{let p=re(e,t,n.typeAnnotation,r,i);for(let[d,f]of p)c.set(d,f);break}case"TSTypeReference":{let p=Ge(n.typeName);if(!p||i.has(p))break;let d=r.get(p);if(!d)break;i.add(p);let f=re(e,t,d,r,i);i.delete(p);let y=Ht(t,d,n);for(let[T,M]of f)c.set(T,y.size===0?M:{...M,type:jt(M.type,y)});break}case"TSIntersectionType":for(let p of n.types??[]){let d=re(e,t,p,r,i);for(let[f,y]of d)c.set(f,y)}break;case"TSParenthesizedType":{let p=re(e,t,n.typeAnnotation,r,i);for(let[d,f]of p)c.set(d,f);break}}return c}function Xe(e,t,n){if(t.runesPropsDeclarationMetadataByDeclaratorStart.clear(),t.explicitPropTypesByName.clear(),t.explicitVariableTypesByName.clear(),t.typeImportBindingsByLocalName.clear(),t.localTypeDeclarationsByName.clear(),t.typedRunesPropsDeclarations.length=0,!t.source)return;let r=n;t.scriptLanguage=e.resolveScriptLanguage(r),t.customElementTag=r.options?.customElement?.tag,t.runesOptionOverride=r.options?.runes,t.scriptGenericsAttribute=e.resolveScriptGenericsAttribute(r);let i=r.instance?.content?.body??[];for(let c of i){if(!c?.type)continue;if(c.type==="ImportDeclaration"&&c.source?.value)for(let s of c.specifiers??[]){let p=s.local?.name;if(!p)continue;if(!(c.importKind==="type"||s.importKind==="type"))continue;let f,y;if(s.type==="ImportSpecifier")f="named",y=s.imported?.type==="Identifier"?s.imported.name:typeof s.imported?.value==="string"?s.imported.value:void 0;else if(s.type==="ImportDefaultSpecifier")f="default";else if(s.type==="ImportNamespaceSpecifier")f="namespace";if(!f)continue;t.typeImportBindingsByLocalName.set(p,{importedName:y,localName:p,source:String(c.source.value),specifierType:f})}if((c.type==="TSInterfaceDeclaration"||c.type==="TSTypeAliasDeclaration")&&c.id?.name&&c.start!==void 0&&c.end!==void 0)t.localTypeDeclarationsByName.set(c.id.name,{code:J(t,c.start,c.end)?.trim()??"",node:c,start:c.start});if(c.type==="ExportNamedDeclaration"&&c.declaration?.type==="VariableDeclaration")for(let s of c.declaration.declarations??[]){if(s.id?.type!=="Identifier"||!s.id.name)continue;let p=fe(t,s.id.typeAnnotation);if(p)t.explicitPropTypesByName.set(s.id.name,p)}else if(c.type==="VariableDeclaration")for(let s of c.declarations??[]){if(s.id?.type!=="Identifier"||!s.id.name)continue;let p=fe(t,s.id.typeAnnotation);if(p)t.explicitVariableTypesByName.set(s.id.name,p)}}for(let c of i){if(!c||typeof c!=="object"||!("declarations"in c))continue;for(let s of c.declarations??[]){if(!_(K(s.init),"$props"))continue;let p=s.id?.typeAnnotation?void 0:_e(s.init),d=s.id?.typeAnnotation?.typeAnnotation??p,f=s.id?.typeAnnotation?fe(t,s.id.typeAnnotation):Ke(t,p),y=re(e,t,d,new Map(Array.from(t.localTypeDeclarationsByName.entries(),([w,A])=>[w,A.node]))),T=new Set,M=new Set;if(Je(t,d,T,M),ze(t,T,M),s.start!==void 0){let w={canonicalType:f,props:y,referencedImportedTypes:T,referencedLocalTypes:M};if(t.runesPropsDeclarationMetadataByDeclaratorStart.set(s.start,w),f)t.typedRunesPropsDeclarations.push(w)}}}}function qe(e,t,n){for(let r of n.declarations){if(!_(K(r.init),"$props"))continue;if(r.id.type==="Identifier"){t.wholePropsLocals.add(r.id.name),t.restPropLocals.add(r.id.name);let s=Oe(t,r.start);if(s)for(let[p,d]of s.props)oe(e,t,p,{name:p,kind:"let",type:d.type,typeSource:"typescript",isFunction:!1,isFunctionDeclaration:!1,isRequired:!d.optional,constant:!1,reactive:!1,source:d.source});continue}if(r.id.type!=="ObjectPattern")continue;let i=z(t,e,n),c=r.id.properties.filter((s)=>{if(s.type!=="Property"||s.computed)return!1;if(!e.getPropertyName(s.key))return!1;if(s.value.type==="Identifier")return!0;return s.value.type==="AssignmentPattern"&&s.value.left.type==="Identifier"}).length;for(let s of r.id.properties){if(s.type==="RestElement"){if(s.argument.type==="Identifier")t.restPropLocals.add(s.argument.name);continue}let p=e.getPropertyName(s.key);if(!p)continue;let d,f;if(s.value.type==="Identifier")d=s.value.name;else{let m=s.value;d=m.left.name,f=m.right}if(!d)continue;if(e.trackPropLocalName(p,d),p==="children")t.snippetPropLocals.add(d);let y=We(t,e,s)??(c===1?i:void 0),T=$e(t,r.start,p),{init:M,bindable:w}=Ve(f),A=M==null?{isFunction:!1}:ie(e,t,M),{value:Q,type:Z,isFunction:ae,defaultValue:be}=A,xe=T?.type===void 0&&y?.type===void 0?A.resolvedType:void 0;if(A.pendingCallDefault)t.pendingCallDefaultCandidates.push({propName:p,location:"props",...A.pendingCallDefault});let{type:he,typeSource:se,description:ce,params:pe,returnType:o,isFunction:a}=ne({explicitType:T?.type,typeSeed:Z,inferredTypeForSource:Z,jsdocType:y?.type,jsdocDescription:y?.description,jsdocParams:y?.params,jsdocReturnType:y?.returnType,resolvedType:xe,resolvedDescription:A.resolvedDescription,resolvedParams:A.resolvedParams,resolvedReturnType:A.resolvedReturnType,initializerIsFunction:ae,isFunctionDeclaration:!1,inferIsFunctionFromTypeSignature:!0});if(w)t.reactive_vars.add(p);oe(e,t,p,{name:p,...d===p?{}:{localName:d},kind:"let",description:ce,binding:y?.binding,deprecated:y?.deprecated,tags:y?.tags,...w?{bindable:!0}:{},type:he,typeSource:se,value:Q,defaultValue:be,params:pe,returnType:o,isFunction:a,isFunctionDeclaration:!1,isRequired:M==null&&T?.optional!==!0,constant:!1,reactive:w,source:N(t,s)})}}}function Ue(e,t){if(e.syntaxMode!=="runes")return;for(let[n,r]of Array.from(e.events.entries())){if(r.type!=="dispatched")continue;if(t.has(n)||e.forwardedEvents.has(n))continue;let i=`on${n}`,c=e.props.get(i);if(!c)continue;let s=c.type!==void 0||c.params!==void 0||c.returnType!==void 0,p=r.detail===void 0||r.detail==="undefined"||r.detail==="null"?"() => void":`(detail: ${r.detail}) => void`;e.props.set(i,{...c,description:c.description??r.description,type:s?c.type:p,typeSource:s?c.typeSource:"inferred",isFunction:!0}),e.events.delete(n)}}var Ye=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function ye(e){if(!e||typeof e!=="object")return;B(e,{enter(t){if(!Ye.has(t.type))return;let n=t.expression;while(n&&Ye.has(n.type))n=n.expression;if(n)this.replace(n)}})}function ge(e,t){let n=t.source?.value;if(typeof n!=="string"||t.importKind==="type")return;for(let r of t.specifiers??[]){if(r.type!=="ImportSpecifier"||r.importKind==="type")continue;let i=r.local?.name;if(!i)continue;let c=r.imported?.name??(typeof r.imported?.value==="string"?r.imported.value:i);e.valueImportBindingsByLocalName.set(i,{localName:i,importedName:c,source:n})}}function Me(e,t){if(!t)return;B(t,{enter(n){if(n.type==="ImportDeclaration")ge(e,n);if(n.type==="FunctionDeclaration"){let r=n;if(r.id?.name)e.funcDecls.set(r.id.name,r)}}})}function nt(e,t,n){let r=t+1;while(r<e.length){if(e[r]==="\\"){r+=2;continue}if(e[r]===n)return r+1;r++}return r}function rt(e,t){let n=t+1,r=0;while(n<e.length){let i=e[n];if(i==="\\"){n+=2;continue}if(r===0){if(i==="`")return n+1;if(i==="$"&&e[n+1]==="{"){r=1,n+=2;continue}n++;continue}if(i==="{")r++;else if(i==="}")r--;else if(i==='"'||i==="'"){n=nt(e,n,i);continue}else if(i==="`"){n=rt(e,n);continue}n++}return n}function Ft(e,t){let n=[],r=e.length,i=0;while(i<r){let c=e[i];if(c==='"'||c==="'"){i=nt(e,i,c);continue}if(c==="`"){i=rt(e,i);continue}if(c==="/"&&e[i+1]==="/"){let s=i+2;while(s<r&&e[s]!==`
|
|
2
|
-
`)s++;i=s;continue}if(c==="/"&&e[i+1]==="*"){let s=i,p=i+2;while(p<r&&!(e[p]==="*"&&e[p+1]==="/"))p++;let d=Math.min(p+2,r),f=e.slice(s,d);n.push({end:d+t,isJsDoc:f.startsWith("/**")&&f.length>4,text:f}),i=d;continue}i++}return n}function Qe(e,t,n){if(!e||typeof e!=="object"||!("type"in e))return;let r=e;if(r.type==="FunctionDeclaration"){if(r.id?.type==="Identifier"&&r.id.name)n.push({name:r.id.name,start:t});return}if(r.type==="VariableDeclaration"){for(let i of r.declarations??[])if(i?.id?.type==="Identifier"&&i.id.name)n.push({name:i.id.name,start:t})}}function Bt(e){let t=[];for(let n of e){if(!n||typeof n!=="object"||!("type"in n))continue;let r=n;if(r.start===void 0)continue;if(r.type==="ExportNamedDeclaration"&&r.declaration)Qe(r.declaration,r.start,t);else Qe(r,r.start,t)}return t}function _t(e,t,n){let r;for(let i of e){if(i.end>t)break;if(!i.isJsDoc)continue;if(!et.test(n.slice(i.end,t)))continue;r=i}return r}function ot(e,t){let n=new Map;if(!e.source)return n;let r=[e.parsed?.module,e.parsed?.instance],i=[],c=[];for(let s of r){let p=s?.content;if(!p?.body||p.start===void 0||p.end===void 0)continue;i.push(...Ft(e.source.slice(p.start,p.end),p.start)),c.push(...Bt(p.body))}i.sort((s,p)=>s.end-p.end);for(let s of c){let p=_t(i,s.start,e.source);if(!p)continue;let d=Ze(p.text),{type:f,description:y}=tt(d);if(!f)continue;n.set(s.name,{type:t.aliasType(f.type),description:y||f.description})}return n}function it(e){if(e==="var")return"let";if(e==="using"||e==="await using")return"const";return e}var Vt=null,at=/^@component/,Ot=/\r/g,$t=/^\{\s*\}$/;class k{ctx=Se();static mapToArray(e){return Array.from(e,([t,n])=>n)}static getStaticAttributeValue(e){if(!Array.isArray(e.value))return;return e.value.map((t)=>t.data??t.raw??"").join("").trim()}resolveScriptLanguage(e){let t=[e.instance,e.module].filter((r)=>r!==void 0),n=!1;for(let r of t){let i=r.attributes?.find((s)=>s.name==="lang");if(!i){n=!0;continue}if(k.getStaticAttributeValue(i)?.toLowerCase()==="ts")return"ts"}return n?"js":void 0}resolveScriptGenericsAttribute(e){let t=e.instance?.attributes?.find((s)=>s.name==="generics");if(!t)return;let n=N(this.ctx,t),r=e.instance?.attributes?.find((s)=>s.name==="lang");if((r?k.getStaticAttributeValue(r)?.toLowerCase():void 0)!=="ts"){Y(this.ctx,"syntax-skipped","generics",'<script generics="..."> requires lang="ts"; the generics attribute was ignored because the script is not TypeScript.',n);return}let c=k.getStaticAttributeValue(t);if(!c)return;return{value:c,source:n}}resolvePublicPropName(e){return this.ctx.propLocalToPublicName.get(e)??e}trackPropLocalName(e,t=e){this.ctx.propLocalToPublicName.set(t,e)}getPropByLocalOrPublic(e){return this.ctx.props.get(this.resolvePublicPropName(e))}getPropTypeByLocalOrPublic(e){return this.getPropByLocalOrPublic(e)?.type}getExplicitPropType(e){return this.ctx.explicitPropTypesByName.get(e)}getPropertyName(e){if(!e||typeof e!=="object"||!("type"in e))return;if(Te(e))return e.name;if(st(e))return e.value==null?void 0:String(e.value);return}isNumericConstant(e){if(!e||typeof e!=="object"||!("type"in e))return!1;if(e.type!=="MemberExpression")return!1;let t=e,n=t.object&&"name"in t.object?t.object.name:void 0,r=t.property&&"name"in t.property?t.property.name:void 0;if(!n||!r)return!1;if(n==="Number")return["POSITIVE_INFINITY","NEGATIVE_INFINITY","MAX_VALUE","MIN_VALUE","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","EPSILON","NaN"].includes(r);if(n==="Math")return["PI","E","LN2","LN10","LOG2E","LOG10E","SQRT2","SQRT1_2"].includes(r);return!1}resolveLocalVarJSDoc(e){for(let n of this.ctx.vars)if(n.declarations.some((i)=>i.id&&typeof i.id==="object"&&("type"in i.id)&&i.id.type==="Identifier"&&("name"in i.id)&&i.id.name===e))return z(this.ctx,this,n);let t=this.ctx.funcDecls.get(e);if(t)return z(this.ctx,this,t);return}addModuleExport(e,t){if(dt(e)===void 0)return;if(this.ctx.moduleExports.has(e)){let n=this.ctx.moduleExports.get(e);this.ctx.moduleExports.set(e,{...n,...t})}else this.ctx.moduleExports.set(e,t)}aliasType(e){if(e==="*")return"any";return e.trim()}findVariableTypeAndDescription(e){let t=this.getPropByLocalOrPublic(e);if(t?.type)return{type:t.type,description:t.description};if(!this.ctx.variableInfoCacheBuilt)this.ctx.variableInfoCache=ot(this.ctx,this),this.ctx.variableInfoCacheBuilt=!0;let n=this.ctx.variableInfoCache.get(e),r=this.ctx.explicitVariableTypesByName.get(e);if(r)return{type:r,description:n?.description};return n??null}accumulateGeneric(e,t){if(this.ctx.generics)this.ctx.generics=[`${this.ctx.generics[0]}, ${e}`,`${this.ctx.generics[1]}, ${t}`];else this.ctx.generics=[e,t]}cleanup(){this.ctx=Se()}static SCRIPT_BLOCK_REGEX=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi;static TS_DIRECTIVE_REGEX=/\/\/\s*@ts-[^\n\r]*/g;static stripTypeScriptDirectivesFromScripts(e){return k.SCRIPT_BLOCK_REGEX.lastIndex=0,e.replace(k.SCRIPT_BLOCK_REGEX,(t,n,r,i)=>{k.TS_DIRECTIVE_REGEX.lastIndex=0;let c=r.replace(k.TS_DIRECTIVE_REGEX,"");return n+c+i})}parseSvelteComponent(e,t){this.cleanup(),this.ctx.componentFilePath=t.filePath;let n=k.stripTypeScriptDirectivesFromScripts(e);this.ctx.source=n;let{modern:r,intoLegacy:i}=St(n);if(Xe(this,this.ctx,r),this.ctx.parsed=i(),this.ctx.scriptLanguage==="ts")ye(this.ctx.parsed.module),ye(this.ctx.parsed.instance),ye(this.ctx.parsed.html);this.ctx.syntaxMode=Be(this.ctx);let c=this.ctx.parsed.css,s=c?.start!==void 0&&c?.end!==void 0?n.slice(0,c.start)+" ".repeat(c.end-c.start)+n.slice(c.end):n;ht(this.ctx,this,s);let p={type:"ComponentRoot",instance:this.ctx.parsed.instance,html:this.ctx.parsed.html};if(Me(this.ctx,this.ctx.parsed?.module),Me(this.ctx,this.ctx.parsed?.instance),this.ctx.parsed?.module)B(this.ctx.parsed?.module,{enter:(o)=>{if(o.type==="ImportDeclaration")ge(this.ctx,o);if(o.type==="FunctionDeclaration"){let a=o;if(a.id?.name)this.ctx.funcDecls.set(a.id.name,a)}if(o.type==="VariableDeclaration")this.ctx.vars.add(o);if(o.type==="ExportNamedDeclaration"){if(o.declaration==null)return;if(!o.declaration||typeof o.declaration!=="object"||!("type"in o.declaration))return;let a,m,b=!1,l,u,x,S=!1,g,D,h;if(o.declaration.type==="FunctionDeclaration"){let H=o.declaration;if(!H.id?.name)return;a=H.id.name,m="function",l=void 0,u="() => any",S=!0,b=!0}else if(o.declaration.type==="VariableDeclaration"){let H=o.declaration,X=H.declarations[0];if(!X||typeof X!=="object"||!("id"in X))return;let{id:q,init:le}=X;if(!q||typeof q!=="object"||!("name"in q))return;let ee=q.name;a=ee,m=it(H.kind);let v=le==null?{isFunction:!1}:ie(this,this.ctx,le);if({value:l,type:u,isFunction:S,defaultValue:g}=v,D=u,h=v,x=this.getExplicitPropType(ee),h.pendingCallDefault)this.ctx.pendingCallDefaultCandidates.push({propName:ee,location:"moduleExports",...h.pendingCallDefault})}else return;let L=z(this.ctx,this,o),{type:j,typeSource:V,description:P,params:R,returnType:I,isFunction:W}=ne({explicitType:x,typeSeed:u,inferredTypeForSource:D,jsdocType:L?.type,jsdocDescription:L?.description,jsdocParams:L?.params,jsdocReturnType:L?.returnType,resolvedType:h?.resolvedType,resolvedDescription:h?.resolvedDescription,resolvedParams:h?.resolvedParams,resolvedReturnType:h?.resolvedReturnType,initializerIsFunction:S,isFunctionDeclaration:b,typedefs:this.ctx.typedefs});this.addModuleExport(a,{name:a,kind:m,description:P,deprecated:L?.deprecated,tags:L?.tags,type:j,typeSource:V,value:l,defaultValue:g,params:R,returnType:I,isFunction:W,isFunctionDeclaration:b,isRequired:!1,constant:m==="const",reactive:!1,source:N(this.ctx,o)})}}});let d,f=new Set,y=new Set,T=[];Ie(this,this.ctx),this.ctx.activeScopes.push(this.ctx.componentScope);let M=Ae(this.ctx);if(B(p,{enter:(o,a,m)=>{He(this,this.ctx,M,o);let b=this.ctx.scopeDeclarations.get(o);if(b)this.ctx.activeScopes.push(b);if(o.type==="AssignmentExpression")Ee(this.ctx,o.left);if(o.type==="UpdateExpression")Ee(this.ctx,o.argument);if(o.type==="CallExpression"){let l=o,u=l.callee&&typeof l.callee==="object"&&"name"in l.callee?l.callee.name:void 0;if(u==="createEventDispatcher"){if(a&&typeof a==="object"&&"id"in a&&a.id&&typeof a.id==="object"&&"name"in a.id)d=a.id.name}if(u==="$host"){if(a&&typeof a==="object"&&"id"in a&&a.id&&typeof a.id==="object"&&"name"in a.id)f.add(a.id.name)}if(u==="setContext")ut(this.ctx,this,o,a??void 0);if(u)T.push({name:u,arguments:l.arguments,source:N(this.ctx,l)});if(ct(l.callee)&&Te(l.callee.property)&&l.callee.property.name==="dispatchEvent"&&(_(l.callee.object,"$host")||Te(l.callee.object)&&f.has(l.callee.object.name))){let x=yt(this.ctx,l);if(x)y.add(x)}}if(o&&typeof o==="object"&&"type"in o&&String(o.type)==="Spread"){let l=o;if(l.expression?.name==="$$restProps"||this.ctx.restPropLocals.has(l.expression?.name??""))Ne(this.ctx,a)}if(o.type==="FunctionDeclaration"){let l=o;if(l.id?.name)this.ctx.funcDecls.set(l.id.name,l)}if(o.type==="ImportDeclaration")ge(this.ctx,o);if(o.type==="VariableDeclaration"){if(this.ctx.vars.add(o),a&&typeof a==="object"&&"type"in a&&a.type==="Program"&&o.declarations.some((l)=>_(K(l.init),"$props")))qe(this,this.ctx,o)}if(o.type==="ExportNamedDeclaration"){if(o.declaration==null&&o.specifiers.length===0)return;let l;if(o.declaration==null&&o.specifiers[0]?.type==="ExportSpecifier"){let v=o.specifiers[0],O=v.local&&typeof v.local==="object"&&"name"in v.local?v.local.name:void 0,G=v.exported&&typeof v.exported==="object"&&"name"in v.exported?v.exported.name:void 0;if(!O||!G)return;let U;for(let te of Array.from(this.ctx.vars))if(te.declarations.some((F)=>F.id&&typeof F.id==="object"&&("type"in F.id)&&F.id.type==="Identifier"&&F.id.name===O)){U=te;break}o.declaration=U,l=G}if(o.declaration==null)return;if(!o.declaration||typeof o.declaration!=="object"||!("type"in o.declaration))return;let u,x=!1,S,g,D,h=!1,L=!1,j,V,P,R;if(o.declaration.type==="FunctionDeclaration"){let v=o.declaration;if(!v.id?.name)return;l??=v.id.name,j=v.id.name,u="function",S=void 0,g="() => any",h=!0,x=!0,L=!1}else if(o.declaration.type==="VariableDeclaration"){let v=o.declaration,O=v.declarations[0];if(!O||typeof O!=="object"||!("id"in O))return;let{id:G,init:U}=O;if(G&&typeof G==="object"&&"name"in G){let F=G.name;j=F,l??=F,D=this.getExplicitPropType(F)}else return;u=it(v.kind),L=u==="let"&&U==null;let te=U==null?{isFunction:!1}:ie(this,this.ctx,U);if({value:S,type:g,isFunction:h,defaultValue:V}=te,P=g,R=te,R.pendingCallDefault)this.ctx.pendingCallDefaultCandidates.push({propName:l,location:"props",...R.pendingCallDefault})}else return;let I=z(this.ctx,this,o),{type:W,typeSource:H,description:X,params:q,returnType:le,isFunction:ee}=ne({explicitType:D,typeSeed:g,inferredTypeForSource:P,jsdocType:I?.type,jsdocDescription:I?.description,jsdocParams:I?.params,jsdocReturnType:I?.returnType,resolvedType:R?.resolvedType,resolvedDescription:R?.resolvedDescription,resolvedParams:R?.resolvedParams,resolvedReturnType:R?.resolvedReturnType,initializerIsFunction:h,isFunctionDeclaration:x,typedefs:this.ctx.typedefs});oe(this,this.ctx,l,{name:l,...j!==void 0&&j!==l?{localName:j}:{},kind:u,description:X,binding:I?.binding,deprecated:I?.deprecated,tags:I?.tags,type:W,typeSource:H,value:S,defaultValue:V,params:q,returnType:le,isFunction:ee,isFunctionDeclaration:x,isRequired:L,constant:u==="const",reactive:this.ctx.reactive_vars.has(l),source:N(this.ctx,o)})}if(o&&typeof o==="object"&&"type"in o&&String(o.type)==="Comment"){let u=o?.data?.trim()??"";if(at.test(u))this.ctx.componentComment=u.replace(at,"").replace(Ot,""),this.ctx.componentCommentSource=N(this.ctx,o)}if(o&&typeof o==="object"&&"type"in o&&String(o.type)==="Slot"){let l=o,u=l.attributes?.find((g)=>g.name==="name")?.value?.[0]?.data,x=(l.attributes||[]).filter((g)=>g.name!=="name").reduce((g,D)=>{let h={value:void 0,replace:!1},L=D.value;if(L===void 0)return g;if(L[0]){let j=L[0],{type:V,expression:P,raw:R,start:I,end:W}=j;if(V==="Text"&&R!==void 0)h.value=JSON.stringify(R);else if(V==="AttributeShorthand"&&P&&typeof P==="object"&&"name"in P)h.value=P.name,h.replace=!0;if(P&&typeof P==="object"&&"type"in P){if(P.type==="Literal"&&"value"in P){let H=P.value;h.value=typeof H==="string"?JSON.stringify(H):String(H)}else if(P.type==="MemberExpression")h.value=pt(this.ctx,this,P);else if(P.type!=="Identifier"){if(I!==void 0&&W!==void 0){if(P.type==="ObjectExpression"||P.type==="TemplateLiteral")h.value=J(this.ctx,I+1,W-1)}}}}if(D.name)g[D.name]=h;return g},{}),S=l.children?.map(({start:g,end:D})=>{if(g===void 0||D===void 0)return"";return J(this.ctx,g,D)??""}).join("").trim();De(this.ctx,{slot_name:u,slot_props:x,slot_fallback:S,source:N(this.ctx,o)})}if(o&&typeof o==="object"&&"type"in o&&String(o.type)==="RenderTag"){let l=o,u=xt(this.ctx,l.expression);if(u){let x;if(u.arguments.length===0)x={};else if(u.arguments.length===1&&typeof u.arguments[0]==="object"&&u.arguments[0]&&"type"in u.arguments[0]&&u.arguments[0].type==="ObjectExpression")x=bt(this.ctx,this,u.arguments[0]);else if(u.arguments.length===1)Y(this.ctx,"syntax-skipped",u.publicName,`{@render ${u.publicName}(...)} argument is not a plain object literal; the render call was not mapped to slot metadata.`,N(this.ctx,o));let S=u.publicName==="children"?void 0:u.publicName,g=S===void 0?Vt:S;if(x!==void 0)De(this.ctx,{slot_name:S,slot_props:x,source:N(this.ctx,o)});if(x!==void 0||this.ctx.slots.has(g))this.ctx.snippetPropLocals.add(u.trackingName)}}if(o&&typeof o==="object"&&"type"in o&&String(o.type)==="EventHandler"){let l=o;if(l.expression==null&&l.name){if(a!=null&&typeof a==="object"&&"name"in a){let u=typeof a.name==="string"?a.name:void 0,x="type"in a?String(a.type):void 0;if(u&&x){let S=x==="InlineComponent"?{type:"InlineComponent",name:u}:{type:"Element",name:u};this.ctx.forwardedEvents.set(l.name,S);let g=this.ctx.events.get(l.name),D=this.ctx.eventDescriptions.get(l.name),h=g?.deprecated;if(!g)this.ctx.events.set(l.name,{type:"forwarded",name:l.name,element:S,description:D,deprecated:h,source:N(this.ctx,o)});else if(g.type==="forwarded"&&D&&!g.description)this.ctx.events.set(l.name,{...g,description:D,deprecated:g.deprecated??h,source:g.source||N(this.ctx,o)})}}}}if(a&&typeof a==="object"&&"type"in a&&(String(a.type)==="Element"||String(a.type)==="InlineComponent")&&o&&typeof o==="object"&&"type"in o&&String(o.type)==="Binding"){let l=o;if(l.expression?.name){let u=de(this.ctx,l.expression.name);if(u)this.ctx.reactive_vars.add(u)}if(String(a.type)==="Element"&&l.name==="this"&&l.expression?.name&&"name"in a&&typeof a.name==="string"){let u=de(this.ctx,l.expression.name);if(!u)return;let x=a.name;if(this.ctx.bindings.has(u)){let S=this.ctx.bindings.get(u);if(S&&!S.elements.includes(x))this.ctx.bindings.set(u,{...S,elements:[...S.elements,x]})}else this.ctx.bindings.set(u,{elements:[x]})}}},leave:(o)=>{if(this.ctx.scopeDeclarations.has(o))this.ctx.activeScopes.pop();je(M,o)}}),d!==void 0){for(let o of T)if(o.name===d){let a=o.arguments[0],m=a&&typeof a==="object"&&"value"in a?a.value:void 0,b=o.arguments[1],l=b&&typeof b==="object"&&"value"in b?b.value:void 0;if(m!=null)ft(this.ctx,{name:String(m),detail:l==null?"":mt(l),has_argument:Boolean(b),source:o.source})}}let w=new Set(y);if(d!==void 0){for(let o of T)if(o.name===d){let a=o.arguments[0],m=a&&typeof a==="object"&&"value"in a?a.value:void 0;if(m!=null)w.add(String(m))}}this.ctx.forwardedEvents.forEach((o,a)=>{let m=this.ctx.events.get(a);if(m&&m.type==="dispatched"&&!w.has(a)){let b=this.ctx.eventDescriptions.get(a),l={type:"forwarded",name:a,element:o,description:b,deprecated:m.deprecated,tags:m.tags,source:m.source};if(m.detail!==void 0&&m.detail!=="undefined")l.detail=m.detail;this.ctx.events.set(a,l)}}),Ue(this.ctx,w);let A=this.ctx.syntaxMode==="runes"?new Set(Array.from(this.ctx.snippetPropLocals,(o)=>this.resolvePublicPropName(o))):new Set,Q=k.mapToArray(this.ctx.props).filter((o)=>!A.has(o.name)).map((o)=>{if(this.ctx.bindings.has(o.name)){let a=this.ctx.bindings.get(o.name)?.elements.sort().map((m)=>Le(m)).join(" | ");return{...o,type:`null | ${a}`,typeSource:"inferred",reactive:o.reactive||this.ctx.reactive_vars.has(o.name)}}return{...o,reactive:o.reactive||this.ctx.reactive_vars.has(o.name)}});this.ctx.activeScopes.length=0;let Z=k.mapToArray(this.ctx.slots).map((o)=>{if(!o.slot_props)return o;if(typeof o.slot_props==="string")return $t.test(o.slot_props)?{...o,slot_props:"Record<string, never>"}:o;let a=o.slot_props,m=[];for(let l of Object.keys(a)){if(a[l].replace&&a[l].value!==void 0)a[l].value=this.getPropTypeByLocalOrPublic(a[l].value);if(a[l].value===void 0)a[l].value="any";m.push(`${l}: ${a[l].value}`)}let b=m.length===0?"Record<string, never>":m.length===1?`{ ${m[0]} }`:`{
|
|
3
|
-
${m.join(`;
|
|
4
|
-
`)};
|
|
5
|
-
}`;return{...o,slot_props:b}}).sort((o,a)=>{let m=o.name??"",b=a.name??"";if(m<b)return-1;if(m>b)return 1;return 0});if(this.ctx.deferredSlotBlockGenerics.length>0){let o=[...Q.map((a)=>a.type??""),...Z.map((a)=>a.slot_props??"")].join(`
|
|
6
|
-
`);for(let{name:a,constraint:m}of this.ctx.deferredSlotBlockGenerics){let b=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!new RegExp(`\\b${b}\\b`).test(o))continue;this.accumulateGeneric(a,m)}}if(this.ctx.scriptGenericsAttribute){if(this.ctx.generics)Y(this.ctx,"syntax-skipped","generics",'Both the "generics" script attribute and @generics/@template JSDoc tags declare component generics; the script attribute takes precedence and the JSDoc declaration was ignored.',this.ctx.scriptGenericsAttribute.source);this.ctx.generics=Tt(this.ctx.scriptGenericsAttribute.value)}let ae=k.mapToArray(this.ctx.moduleExports),be=k.mapToArray(this.ctx.events).map((o)=>{switch(o.type){case"forwarded":return{...o,element:o.element.name};case"dispatched":return o;default:return o}}).sort((o,a)=>{let m=o.name.localeCompare(a.name);if(m!==0)return m;let b=o.type.localeCompare(a.type);if(b!==0)return b;if(o.type==="forwarded"&&a.type==="forwarded"){let l=o.element.localeCompare(a.element);if(l!==0)return l}return(o.detail??"").localeCompare(a.detail??"")}),xe=k.mapToArray(this.ctx.typedefs),he=k.mapToArray(this.ctx.contexts),se={props:new Map(this.ctx.pendingCallDefaultCandidates.filter((o)=>o.location==="props").map((o)=>[o.propName,o])),moduleExports:new Map(this.ctx.pendingCallDefaultCandidates.filter((o)=>o.location==="moduleExports").map((o)=>[o.propName,o]))};for(let o of Q)if(o.typeSource==="unknown"){let a=se.props.get(o.name);if(a)o.type="any";let m=a?a.importSource?`Prop "${o.name}" default calls "${a.calleeName}()" imported from "${a.importSource}"; falling back to "any" pending cross-file resolution.`:`Prop "${o.name}" default calls "${a.calleeName}()", but its return type could not be inferred; falling back to "any".`:`Prop "${o.name}" type could not be inferred; falling back to "${o.type??"any"}".`;Y(this.ctx,"prop-unknown-type",o.name,m,o.source)}for(let o of ae)if(o.typeSource==="unknown"&&se.moduleExports.has(o.name))o.type="any";for(let o of this.ctx.jsDocEventNames){if(w.has(o))continue;if(this.ctx.forwardedEvents.has(o))continue;if(this.ctx.props.has(`on${o}`))continue;Y(this.ctx,"event-no-source",o,`@event "${o}" has no matching dispatch or callback prop.`,this.ctx.jsDocEventSources.get(o))}let ce={source:lt(this.ctx,0,this.ctx.source?.length),syntaxMode:this.ctx.syntaxMode,...this.ctx.scriptLanguage?{scriptLanguage:this.ctx.scriptLanguage}:{},props:Q,moduleExports:ae,slots:Z,events:be,typedefs:xe,generics:this.ctx.generics,rest_props:this.ctx.rest_props,extends:this.ctx.extends,componentComment:this.ctx.componentComment,componentCommentSource:this.ctx.componentCommentSource,contexts:he,customElementTag:this.ctx.customElementTag,diagnostics:this.ctx.diagnosticRecords.slice()},pe=gt(this.ctx);if(pe)ce[Ce]=pe;return ce}}
|
|
7
|
-
export{k as t};
|
package/lib/chunk-n5cjh6db.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{na as a,oa as b}from"./chunk-0beysrt7.js";import"./chunk-nrz6c5ew.js";import"./chunk-ptdfswsv.js";export{a as parse,b as parseModern};
|