sveld 0.38.4 → 0.38.5
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/browser.js +67 -67
- package/{chunk-8v3hb5br.js → chunk-an5rdwgz.js} +63 -63
- package/{chunk-3z90f57k.js → chunk-f31zr5zg.js} +1 -1
- package/{chunk-6s52n40s.js → chunk-g1rqx8nx.js} +1 -1
- package/{chunk-4kzw8twf.js → chunk-y50sqsxa.js} +1 -1
- package/cli-entry.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n}from"./chunk-
|
|
1
|
+
import{n}from"./chunk-an5rdwgz.js";import{existsSync as T,readdirSync as x,readFileSync as _,statSync as k}from"node:fs";import{createRequire as P}from"node:module";import c from"node:path";var R=/[^A-Za-z0-9_-]/g,C=/[^A-Za-z0-9_$]/g,w=/^[0-9]/,I=2,f=7,m=`TypeScript ${f} or later, which provides \`typescript/unstable/async\``;function N(e){if(!e)return!1;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>=f}async function b(e){let t;try{let i=P(c.join(e,"package.json")).resolve("typescript/package.json");t=JSON.parse(_(i,"utf8")).version}catch{return{installed:!1}}if(!N(t))return{installed:!0,version:t};try{let s=await import("./chunk-1azsj0zd.js");return{installed:!0,version:t,module:s}}catch{return{installed:!0,version:t}}}class d{api=null;tsconfigPath;overlay=new Map;constructor(e){this.tsconfigPath=e}static async create(e=process.cwd(),{importTs:t=b}={}){let s=await t(e);if(!s.installed)return{ok:!1,reason:"not-installed",message:`requires the \`typescript\` package to be installed (${m}); none was found`};if(!s.module)return{ok:!1,reason:"unsupported-version",message:`requires ${m}; found \`typescript@${s.version??"unknown"}\` installed, which does not expose that module`};let i=F(e);if(!i)return{ok:!1,reason:"no-tsconfig",message:`could not locate a tsconfig.json starting from "${e}"`};let r=new d(i);return r.api=new s.module.API({cwd:e,fs:r.createFileSystem()}),{ok:!0,resolver:r}}async checkExamples(e){let t=new Map,s=[];for(let r of e)for(let o of r.sources){let a=this.exampleFileName(r.filePath,r.moduleName,o.id);this.overlay.set(a,j(o)),s.push({filePath:r.filePath,source:o,file:a})}if(s.length===0)return t;let i=await this.api.updateSnapshot({openProject:this.tsconfigPath,fileChanges:{created:s.map((r)=>r.file)}});try{let r=await i.getDefaultProjectForFile(s[0].file);if(!r)return t;await Promise.all(s.map(async({filePath:o,source:a,file:p})=>{let[h,y]=await Promise.all([r.program.getSyntacticDiagnostics(p),r.program.getSemanticDiagnostics(p)]),u=[...h,...y];if(u.length===0)return;let E=this.overlay.get(p)??"",v=u.map((l)=>A(l,E)).sort((l,S)=>l.line-S.line).map((l)=>`Line ${l.line}: ${l.text}`).join(`
|
|
2
2
|
`),g=t.get(o)??[];g.push({id:a.id,name:a.name,message:v}),t.set(o,g)}))}finally{await i.dispose?.()}return t}async dispose(){this.overlay.clear(),await this.api?.close?.()}createFileSystem(){return{readFile:(e)=>this.overlay.get(n(e)),fileExists:(e)=>this.overlay.has(n(e))?!0:void 0,getAccessibleEntries:(e)=>{let t=n(e),s=Array.from(this.overlay.keys()).filter((o)=>n(c.dirname(o))===t);if(s.length===0)return;let i=[],r=[];try{for(let o of x(e)){let a=c.join(e,o);try{(k(a).isDirectory()?r:i).push(o)}catch{}}}catch{}for(let o of s){let a=c.basename(o);if(!i.includes(a))i.push(a)}return{files:i,directories:r}}}}exampleFileName(e,t,s){let i=c.dirname(c.resolve(e)),r=s.replace(R,"_");return n(c.join(i,`__sveld_example_${t}_${r}.ts`))}}function D(e){let t=e.replace(C,"_");if(t===""||w.test(t))return`_${t}`;return t}function j(e){return`const ${D(e.name)} = null as unknown as (${e.type});
|
|
3
3
|
${e.code}
|
|
4
4
|
`}function A(e,t){let s=e.pos??0,i=t.slice(0,s).split(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x,te,g,P,ve,G,ne,Ce,W,T,u,a,i,qe,A,t,b,p,f,w,Fe,De,v,c,s,re,_,ie,o,H,z,X,E,Q,S,y,l,O,Y,ce,Pe,Ae,pe,Ue,_e,ue,le,h,k,r,fe,de,e,Ge,We,He,ze,Xe,Qe,Ye,Ze,Ke,et,Ne,tt,nt,Ie,rt,it,st,ot,Re,Le,at,Me,ct,pt,C,ut,lt,ft,dt,mt,ht,gt,yt,xt,Oe,Tt,Et,St,kt,bt,wt,me,vt,Ct,Dt,$e,Pt,At,_t,Nt,d,It,Rt,Lt,he,ge,B,Mt,Ot,j,xe,N}from"./chunk-
|
|
1
|
+
import{x,te,g,P,ve,G,ne,Ce,W,T,u,a,i,qe,A,t,b,p,f,w,Fe,De,v,c,s,re,_,ie,o,H,z,X,E,Q,S,y,l,O,Y,ce,Pe,Ae,pe,Ue,_e,ue,le,h,k,r,fe,de,e,Ge,We,He,ze,Xe,Qe,Ye,Ze,Ke,et,Ne,tt,nt,Ie,rt,it,st,ot,Re,Le,at,Me,ct,pt,C,ut,lt,ft,dt,mt,ht,gt,yt,xt,Oe,Tt,Et,St,kt,bt,wt,me,vt,Ct,Dt,$e,Pt,At,_t,Nt,d,It,Rt,Lt,he,ge,B,Mt,Ot,j,xe,N}from"./chunk-an5rdwgz.js";function qr(){return{syntaxMode:"legacy",scriptLanguage:void 0,source:void 0,parsed:void 0,runesOptionOverride:void 0,sourceLocator:void 0,parsedJsDocByText:new Map,jsDocBlocksByStart:new Map,functionDocCommentStarts:new Set,rest_props:void 0,extends:void 0,customElementTag:void 0,customElement: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:[],pendingConstDefaultCandidates:[],pendingContextKeyCandidates:[],pendingDispatchEscapeCandidates:[],deferredEventNoSourceDiagnostics:[],runesPropsDeclarationMetadataByDeclaratorStart:new Map,typedRunesPropsDeclarations:[],explicitPropTypesByName:new Map,explicitVariableTypesByName:new Map,explicitVariableTypeNodesByName:new Map,typeImportBindingsByLocalName:new Map,localTypeDeclarationsByName:new Map,additionalTypeDependencyNodes:[],additionalImportedTypes:new Map,wholePropsLocals:new Set,restPropLocals:new Set,componentScope:new Map,scopeDeclarations:new Map,activeScopes:[],slots:new Map,snippetPropLocals:new Set,jsDocSlots:new Map,renderedSlots:new Set,slotsUntracked:!1,cssParts:[],cssProperties:[],deferredSlotBlockGenerics:[],events:new Map,eventDescriptions:new Map,forwardedEvents:new Map,jsDocEventNames:new Set,untypedJsDocEventNames:new Set,jsDocEventSources:new Map,bindings:new Map,typeCasts:{constAssertions:new WeakSet,typeAssertions:new WeakMap},contexts:new Map,typedefs:new Map,typedefMembersByName:new Map,variableInfoCache:new Map,variableInfoCacheBuilt:!1,sveldIgnoreDirectives:new Map}}function Rr(n,m){return n.propLocalToPublicName.get(m)??m}function Jn(n,m,D=m){n.propLocalToPublicName.set(D,m)}function Fr(n,m){return n.props.get(Rr(n,m))}function qn(n,m){return Fr(n,m)?.type}function ye(n,m,D,L,I){n.diagnosticRecords.push(jr(n,m,D,L,I))}function jr(n,m,D,L,I){return o({component:n.componentFilePath,kind:m,name:D,message:L,...I?{source:I}:{},...Br(n,m,D)?{ignored:!0}:{}})}function Hi(n,m){return`${n}:${m}`}function Qt(n,m,D,L){if(!L||L.length===0)return;let I=Hi(m,D),q=n.sveldIgnoreDirectives.get(I)??new Set;for(let R of L)q.add(R);n.sveldIgnoreDirectives.set(I,q)}function Br(n,m,D){let L=n.sveldIgnoreDirectives.get(Hi(m,D));if(!L)return!1;return L.has("")||L.has(H[m])}var Wa=/\s/;function $r(n,m,D){let L=m;while(L<D){let I=n[L];if(I==="/"&&n[L+1]==="/"){let q=n.indexOf(`
|
|
2
2
|
`,L+2);if(q===-1||q>=D)return!0;L=q+1}else if(I==="/"&&n[L+1]==="*"&&n[L+2]!=="*"){let q=n.indexOf("*/",L+2);if(q===-1||q+2>D)return!1;L=q+2}else if(I===" "||I===`
|
|
3
3
|
`||I==="\t"||I==="\r"||Wa.test(I))L++;else return!1}return!0}var za=/^-\s*/;function Un(n){let m=[],D,L=!1;for(let I of n){let q=X(I);if(D!==void 0){if(q)m.push(I.trim()),D=void 0;else m.push(I.slice(Math.min(D,z(I))).trimEnd());continue}let R=I.trim();if(R===""){L=m.length>0;continue}if(L)m.push("");if(L=!1,m.push(R),q)D=z(I)}return m.join(`
|
|
4
4
|
`).trimEnd()}function nn(n){return n?.replace(za,"").trim()}function zi(n){let m=n.name?`${n.name} ${n.description}`:n.description;return nn(Un(m.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ye,be}from"./chunk-
|
|
1
|
+
import{ye,be}from"./chunk-an5rdwgz.js";import{Gt,Wt,M,Ft,we,Je,Ht,ee}from"./chunk-g1rqx8nx.js";export{ee as ComponentParser,Ft as deriveLiteralDetailType,Wt as extractJsDocDeprecatedAndTags,Gt as extractJsDocReturnType,be as formatParseError,M as getCommentTags,we as literalDetailToTypeText,ye as parseModule,Je as parseSvelte,Ht as parseSvelteScripts};
|
package/cli-entry.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{se,oe,ae,N,n,$t,Te,Ee,J,Se,ke,Z,q,I,F,K,V,U,D,R,Be,L,qt,je}from"./chunk-
|
|
1
|
+
import{se,oe,ae,N,n,$t,Te,Ee,J,Se,ke,Z,q,I,F,K,V,U,D,R,Be,L,qt,je}from"./chunk-an5rdwgz.js";import{existsSync as v}from"node:fs";import{join as x,resolve as E}from"node:path";var g="src/index.js",h={SUCCESS:0,USAGE_ERROR:1,GENERATION_FAILURE:2,BREAKING_CHANGE:3,DIAGNOSTICS:4},w=`Usage: sveld [options]
|
|
2
2
|
|
|
3
3
|
Generate TypeScript definitions and component documentation for a Svelte
|
|
4
4
|
library. With no flags, only TypeScript definitions are generated for the
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{H,Ve,m,Bt,J,Se,jt,ke,Vt,Jt,Ut}from"./chunk-
|
|
1
|
+
import{H,Ve,m,Bt,J,Se,jt,ke,Vt,Jt,Ut}from"./chunk-an5rdwgz.js";import{ee}from"./chunk-g1rqx8nx.js";export{jt as CHECK_REPORT_SCHEMA_VERSION,ee as ComponentParser,Ve as DIAGNOSTICS_SCHEMA_VERSION,H as DIAGNOSTIC_CODES,m as buildComponentApiDocument,Jt as default,Vt as defineConfig,Bt as diffApiDocuments,Se as formatCheckReport,ke as formatCheckReportJson,J as runCheck,Ut as sveld};
|