@dtsx/dtsx 0.11.52 → 0.11.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +1 -1
- package/dist/{chunk-j0y149qx.js → chunk-0d5nemtn.js} +2 -2
- package/dist/{chunk-3z75j224.js → chunk-0gy70m6b.js} +2 -2
- package/dist/{chunk-p99myphf.js → chunk-0xjw2vdt.js} +2 -2
- package/dist/{chunk-dq0nmept.js → chunk-15qy51py.js} +2 -2
- package/dist/{chunk-vekg5zy6.js → chunk-193aw7d6.js} +1 -1
- package/dist/{chunk-m8w98p7p.js → chunk-1k5r7bpf.js} +3 -3
- package/dist/{chunk-e29deb0h.js → chunk-1mzxq1rg.js} +2 -2
- package/dist/{chunk-4sasxrdr.js → chunk-1t77gtcx.js} +2 -2
- package/dist/{chunk-6e5dyfx2.js → chunk-2q4d5dqw.js} +4 -4
- package/dist/{chunk-x67zh0tr.js → chunk-365k5pgj.js} +2 -2
- package/dist/{chunk-cq5zpg9c.js → chunk-3d49h0bx.js} +2 -2
- package/dist/{chunk-90jwk3zy.js → chunk-4rsk49xj.js} +2 -2
- package/dist/{chunk-02yqpwv0.js → chunk-6b6rt0yh.js} +2 -2
- package/dist/{chunk-g2191y9b.js → chunk-6c8nk9rm.js} +4 -4
- package/dist/{chunk-013mp499.js → chunk-6ekemc3h.js} +2 -2
- package/dist/{chunk-m9b6cqn7.js → chunk-6j4wx5mf.js} +17 -17
- package/dist/{chunk-n0tw6p7g.js → chunk-6r01zgys.js} +1 -1
- package/dist/{chunk-jkeqyj50.js → chunk-6sdswv08.js} +2 -2
- package/dist/chunk-6y728pph.js +3 -0
- package/dist/{chunk-k0exaspt.js → chunk-7dmn623d.js} +3 -3
- package/dist/{chunk-290jpwny.js → chunk-7pw9ayve.js} +3 -3
- package/dist/{chunk-czgjmefa.js → chunk-87mk4nnk.js} +4 -4
- package/dist/{chunk-7ryea8wn.js → chunk-8apqea4x.js} +2 -2
- package/dist/{chunk-4kv50gfv.js → chunk-8r7rmcz7.js} +5 -5
- package/dist/{chunk-3mp0jaa7.js → chunk-8vvryt8p.js} +2 -2
- package/dist/{chunk-anr9ncep.js → chunk-990m77vr.js} +2 -2
- package/dist/{chunk-5cgpcdsb.js → chunk-9bj73ygx.js} +3 -3
- package/dist/{chunk-9wxhpnya.js → chunk-9gdtzkjv.js} +2 -2
- package/dist/{chunk-zpvcnc7c.js → chunk-9mdgtq38.js} +2 -2
- package/dist/{chunk-kf4sza0n.js → chunk-9xvmk7pg.js} +4 -4
- package/dist/{chunk-sbmdk35p.js → chunk-aw6spwvp.js} +2 -2
- package/dist/{chunk-xsaw8abt.js → chunk-btcj8fgc.js} +3 -3
- package/dist/chunk-bys9tn88.js +3 -0
- package/dist/{chunk-fjkswqq2.js → chunk-cdq514ff.js} +1 -1
- package/dist/{chunk-dc0059dr.js → chunk-cp8xdvb6.js} +3 -3
- package/dist/{chunk-cx4rq49z.js → chunk-d6cwtv8p.js} +2 -2
- package/dist/{chunk-a0900w7b.js → chunk-dak0dhnx.js} +2 -2
- package/dist/{chunk-4xvx77zs.js → chunk-egmen4qn.js} +5 -5
- package/dist/{chunk-kcfc6zg6.js → chunk-fpa2ea8k.js} +3 -3
- package/dist/{chunk-t4cdpfrr.js → chunk-g3737b7k.js} +1 -1
- package/dist/{chunk-bkrftw1s.js → chunk-g743tp4d.js} +5 -5
- package/dist/{chunk-b7g1pyea.js → chunk-gdzqt46g.js} +4 -4
- package/dist/{chunk-7xgwvv94.js → chunk-geqq4mmz.js} +2 -2
- package/dist/{chunk-cyzr3xat.js → chunk-gwa4hmfa.js} +2 -2
- package/dist/{chunk-e4f5kxrh.js → chunk-h28vzayq.js} +2 -2
- package/dist/{chunk-1jmwmc2a.js → chunk-h6ddkhyq.js} +2 -2
- package/dist/{chunk-xph91r7p.js → chunk-h7nk8ywf.js} +3 -3
- package/dist/{chunk-taa77k3y.js → chunk-hbmnkmzb.js} +3 -3
- package/dist/{chunk-w60gzzxc.js → chunk-heqx5083.js} +4 -4
- package/dist/{chunk-r9gdz351.js → chunk-hkcqbex1.js} +2 -2
- package/dist/{chunk-9b0jah2a.js → chunk-j4w3zxc1.js} +2 -2
- package/dist/{chunk-937czex4.js → chunk-j67chb8m.js} +2 -2
- package/dist/{chunk-0v6vmemf.js → chunk-j7rpp55s.js} +3 -3
- package/dist/{chunk-1z9550gn.js → chunk-k8tnz2qd.js} +8 -8
- package/dist/{chunk-1y19tmb0.js → chunk-kkshxyex.js} +3 -3
- package/dist/{chunk-g9kqk7y0.js → chunk-mph001z4.js} +4 -4
- package/dist/{chunk-jwcw24cc.js → chunk-mqv5m22t.js} +4 -4
- package/dist/{chunk-9kfzjkd1.js → chunk-msa98cgm.js} +10 -10
- package/dist/{chunk-2q641ekp.js → chunk-mzxxgnp8.js} +1 -1
- package/dist/chunk-na7saw10.js +2 -0
- package/dist/{chunk-ktt2m4eh.js → chunk-nmht3krt.js} +3 -3
- package/dist/{chunk-dhzr60ge.js → chunk-nnayqrp5.js} +2 -2
- package/dist/{chunk-s6bjmr93.js → chunk-pggbb1c0.js} +2 -2
- package/dist/{chunk-xm63aee8.js → chunk-pnfjhm01.js} +2 -2
- package/dist/{chunk-8gksa73c.js → chunk-qbk49jz5.js} +3 -3
- package/dist/{chunk-19626hwq.js → chunk-r0mj8ky4.js} +2 -2
- package/dist/{chunk-m7jndt3v.js → chunk-rc1zpm7f.js} +3 -3
- package/dist/{chunk-5mh2gqd4.js → chunk-rymbw083.js} +2 -2
- package/dist/{chunk-s9e2a0t7.js → chunk-spdw3tc0.js} +2 -2
- package/dist/{chunk-6ekgn7sc.js → chunk-t5nmnzy6.js} +2 -2
- package/dist/{chunk-bsj770f8.js → chunk-tgaear7n.js} +4 -4
- package/dist/{chunk-rwdcmcx3.js → chunk-v22xpr7j.js} +3 -3
- package/dist/{chunk-bj3r4j0a.js → chunk-wvdy228e.js} +4 -4
- package/dist/{chunk-b6xcyrnx.js → chunk-x569v6av.js} +3 -3
- package/dist/{chunk-asws39qs.js → chunk-xn7p8w2c.js} +10 -10
- package/dist/{chunk-4nrrjn7g.js → chunk-ywff3fq9.js} +11 -11
- package/dist/{chunk-3e6q952c.js → chunk-z6amkx8m.js} +6 -6
- package/dist/{chunk-5ym0xgg0.js → chunk-zp7a7th9.js} +2 -2
- package/dist/src/augmentation-graph.js +1 -1
- package/dist/src/binding-patterns.js +1 -1
- package/dist/src/branded-types.js +1 -1
- package/dist/src/bundle-linker.js +1 -1
- package/dist/src/bundler.js +1 -1
- package/dist/src/cache.js +1 -1
- package/dist/src/call-signatures.js +1 -1
- package/dist/src/circular.js +1 -1
- package/dist/src/compat.js +1 -1
- package/dist/src/computed-keys.js +1 -1
- package/dist/src/config.js +1 -1
- package/dist/src/dangling-refs.js +1 -1
- package/dist/src/declaration-project.js +1 -1
- package/dist/src/declaration-publication.js +1 -1
- package/dist/src/declaration-references.js +1 -1
- package/dist/src/diff.js +1 -1
- package/dist/src/docs.js +1 -1
- package/dist/src/enum-declarations.js +1 -1
- package/dist/src/errors.js +1 -1
- package/dist/src/extractor/directives.js +1 -1
- package/dist/src/extractor/extract.js +1 -1
- package/dist/src/extractor/scanner.js +1 -1
- package/dist/src/extractor.js +1 -1
- package/dist/src/formats.js +1 -1
- package/dist/src/formatter.js +1 -1
- package/dist/src/function-properties.js +1 -1
- package/dist/src/generator.js +1 -1
- package/dist/src/global-types.js +1 -1
- package/dist/src/import-sorter.js +1 -1
- package/dist/src/incremental.js +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/inferred-imports.js +1 -1
- package/dist/src/initializer-type-spans.js +1 -1
- package/dist/src/logger.js +1 -1
- package/dist/src/lsp.js +1 -1
- package/dist/src/memory.js +1 -1
- package/dist/src/merger.js +1 -1
- package/dist/src/module-graph.js +1 -1
- package/dist/src/module-references.js +1 -1
- package/dist/src/native-checker.js +1 -1
- package/dist/src/native-engine.js +1 -1
- package/dist/src/native-extractor.js +1 -1
- package/dist/src/native-generation.js +1 -1
- package/dist/src/native-project.js +1 -1
- package/dist/src/optimizer.js +1 -1
- package/dist/src/output-normalizer.js +1 -1
- package/dist/src/parallel-processor.js +1 -1
- package/dist/src/parameters.js +1 -1
- package/dist/src/parser.js +1 -1
- package/dist/src/plugins/bun.js +1 -1
- package/dist/src/plugins/esbuild.js +1 -1
- package/dist/src/plugins/index.js +1 -1
- package/dist/src/plugins/tsdown.js +1 -1
- package/dist/src/plugins/tsup.js +1 -1
- package/dist/src/plugins/vite.js +1 -1
- package/dist/src/plugins/webpack.js +1 -1
- package/dist/src/plugins.js +1 -1
- package/dist/src/process-source.js +1 -1
- package/dist/src/processor/cache.js +1 -1
- package/dist/src/processor/declarations.js +1 -1
- package/dist/src/processor/import-usage.js +1 -1
- package/dist/src/processor/imports.js +1 -1
- package/dist/src/processor/index.js +1 -1
- package/dist/src/processor/type-inference.js +1 -1
- package/dist/src/processor.js +1 -1
- package/dist/src/profiling.js +1 -1
- package/dist/src/return-type-scope.js +1 -1
- package/dist/src/security.js +1 -1
- package/dist/src/source-cache.js +1 -1
- package/dist/src/sourcemap.js +1 -1
- package/dist/src/stx.js +1 -1
- package/dist/src/tracking.js +1 -1
- package/dist/src/transformers.js +1 -1
- package/dist/src/tree-shaker.js +1 -1
- package/dist/src/type-mappings.js +1 -1
- package/dist/src/utils.js +1 -1
- package/dist/src/value-inference.d.ts +2 -0
- package/dist/src/value-inference.js +1 -1
- package/dist/src/vue.js +1 -1
- package/dist/src/watcher.js +1 -1
- package/dist/src/worker-thread.js +1 -1
- package/dist/src/worker.js +1 -1
- package/dist/src/workspace.js +1 -1
- package/native/darwin-arm64/libzig-dtsx.dylib +0 -0
- package/native/darwin-x64/libzig-dtsx.dylib +0 -0
- package/native/freebsd-x64/libzig-dtsx.so +0 -0
- package/native/linux-arm64/libzig-dtsx.so +0 -0
- package/native/linux-x64/libzig-dtsx.so +0 -0
- package/native/windows-x64/zig-dtsx.dll +0 -0
- package/package.json +4 -4
- package/dist/chunk-a04yhmwb.js +0 -3
- package/dist/chunk-nrb601nx.js +0 -2
- package/dist/chunk-zbrj37wa.js +0 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{s}from"./chunk-
|
|
3
|
-
export{mt,
|
|
2
|
+
import{s}from"./chunk-egmen4qn.js";import{mkdtemp as y,readFile as v,realpath as l,rm as x}from"fs/promises";import{tmpdir as b}from"os";import{join as p,resolve as i}from"path";function mt(r={}){if(Reflect.get(r,"declarationMap"))throw Error("dtsx: bundled declaration maps are not supported");let u=new Map,c=(t,n)=>`${i(t)}\x00${n}`;return{name:"dtsx",tsdownConfig:()=>({dts:!1}),tsdownConfigResolved(t){u.set(c(i(t.cwd??process.cwd(),t.outDir??"dist"),t.format),t)},async generateBundle(t,n){let d=u.get(c(t.dir??"dist",t.format??"es"));if(!d)throw Error("dtsx: expected a resolved tsdown build before generating declarations");let f=await l(i(r.cwd??d.cwd??process.cwd())),m=await l(i(f,r.root??d.root)),a=await y(p(b(),"dtsx-tsdown-"));try{for(let e of Object.values(n)){if(e.type!=="chunk"||!e.isEntry||!e.facadeModuleId)continue;let w=await l(e.facadeModuleId),g=e.fileName.endsWith(".cjs")?".d.cts":e.fileName.endsWith(".mjs")?".d.mts":".d.ts",o=e.fileName.replace(/\.(?:c|m)?js$/,g);if(o===e.fileName)throw Error(`dtsx: unsupported tsdown JavaScript output ${e.fileName}`);if((await s({...r,cwd:f,root:m,entrypoints:[w],outdir:a,bundle:!0,bundleOutput:o,clean:!1,dryRun:!1,outputStructure:"mirror",declarationMap:!1,moduleSpecifierMode:r.moduleSpecifierMode??"node"})).filesFailed)throw Error(`dtsx: declaration generation failed for ${e.facadeModuleId}`);this.emitFile({type:"asset",fileName:o,source:await v(p(a,o),"utf8")})}}finally{await x(a,{recursive:!0,force:!0})}}}}var La=mt;
|
|
3
|
+
export{mt,La};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{le}from"./chunk-
|
|
2
|
+
import{le}from"./chunk-6b6rt0yh.js";function M(n,t){let e=n.length,i=t.length,o=Array.from({length:e+1},()=>Array(i+1).fill(0));for(let s=1;s<=e;s++)for(let r=1;r<=i;r++)if(n[s-1]===t[r-1])o[s][r]=o[s-1][r-1]+1;else o[s][r]=Math.max(o[s-1][r],o[s][r-1]);return o}function S(n,t,e,i,o){let s=[];while(i>0||o>0)if(i>0&&o>0&&t[i-1]===e[o-1])s.unshift({op:"equal",oldIdx:i-1,newIdx:o-1,line:t[i-1]}),i--,o--;else if(o>0&&(i===0||n[i][o-1]>=n[i-1][o]))s.unshift({op:"add",newIdx:o-1,line:e[o-1]}),o--;else if(i>0)s.unshift({op:"remove",oldIdx:i-1,line:t[i-1]}),i--;return s}function k(n,t){let e=n;if(t.ignoreWhitespace)e=e.replace(/\s+/g," ").trim();return e}function bt(n,t,e,i={}){let{context:o=3,ignoreWhitespace:s=!1,ignoreBlankLines:r=!1}=i,f=n.split(`
|
|
3
3
|
`),p=t.split(`
|
|
4
|
-
`);if(f[f.length-1]==="")f.pop();if(p[p.length-1]==="")p.pop();let d=f.map((l)=>k(l,{ignoreWhitespace:s})),a=p.map((l)=>k(l,{ignoreWhitespace:s})),c=d,g=a,w=f.map((l,x)=>x),m=p.map((l,x)=>x);if(r)c=[],g=[],w=[],m=[],d.forEach((l,x)=>{if(l.trim())c.push(l),w.push(x)}),a.forEach((l,x)=>{if(l.trim())g.push(l),m.push(x)});let F=M(c,g),b=S(F,c,g,c.length,g.length),B=b.every((l)=>l.op==="equal"),D=0,u=0,h=0;for(let l of b)if(l.op==="add")D++;else if(l.op==="remove")u++;else h++;let y=C(b,f,p,w,m,o);return{filePath:e,identical:B,hunks:y,stats:{additions:D,deletions:u,unchanged:h},oldContent:n,newContent:t}}function C(n,t,e,i,o,s){let r=[],f=[];if(n.forEach((a,c)=>{if(a.op!=="equal")f.push(c)}),f.length===0)return r;let p=[],d=[f[0]];for(let a=1;a<f.length;a++)if(f[a]-f[a-1]<=s*2+1)d.push(f[a]);else p.push(d),d=[f[a]];p.push(d);for(let a of p){let c=Math.max(0,a[0]-s),g=Math.min(n.length-1,a[a.length-1]+s),w=n.slice(c,g+1),m=[],F=1,b=1,B=0,D=0;for(let u=0;u<c;u++){let h=n[u];if(h.op==="equal"||h.op==="remove")F++;if(h.op==="equal"||h.op==="add")b++}for(let u of w)if(u.op==="equal")m.push(` ${u.line}`),B++,D++;else if(u.op==="remove")m.push(`-${u.line}`),B++;else if(u.op==="add")m.push(`+${u.line}`),D++;r.push({operation:"equal",lines:m,oldStart:F,oldCount:B,newStart:b,newCount:D})}return r}function
|
|
5
|
-
`)}function
|
|
6
|
-
`)}function
|
|
7
|
-
export{bt,
|
|
4
|
+
`);if(f[f.length-1]==="")f.pop();if(p[p.length-1]==="")p.pop();let d=f.map((l)=>k(l,{ignoreWhitespace:s})),a=p.map((l)=>k(l,{ignoreWhitespace:s})),c=d,g=a,w=f.map((l,x)=>x),m=p.map((l,x)=>x);if(r)c=[],g=[],w=[],m=[],d.forEach((l,x)=>{if(l.trim())c.push(l),w.push(x)}),a.forEach((l,x)=>{if(l.trim())g.push(l),m.push(x)});let F=M(c,g),b=S(F,c,g,c.length,g.length),B=b.every((l)=>l.op==="equal"),D=0,u=0,h=0;for(let l of b)if(l.op==="add")D++;else if(l.op==="remove")u++;else h++;let y=C(b,f,p,w,m,o);return{filePath:e,identical:B,hunks:y,stats:{additions:D,deletions:u,unchanged:h},oldContent:n,newContent:t}}function C(n,t,e,i,o,s){let r=[],f=[];if(n.forEach((a,c)=>{if(a.op!=="equal")f.push(c)}),f.length===0)return r;let p=[],d=[f[0]];for(let a=1;a<f.length;a++)if(f[a]-f[a-1]<=s*2+1)d.push(f[a]);else p.push(d),d=[f[a]];p.push(d);for(let a of p){let c=Math.max(0,a[0]-s),g=Math.min(n.length-1,a[a.length-1]+s),w=n.slice(c,g+1),m=[],F=1,b=1,B=0,D=0;for(let u=0;u<c;u++){let h=n[u];if(h.op==="equal"||h.op==="remove")F++;if(h.op==="equal"||h.op==="add")b++}for(let u of w)if(u.op==="equal")m.push(` ${u.line}`),B++,D++;else if(u.op==="remove")m.push(`-${u.line}`),B++;else if(u.op==="add")m.push(`+${u.line}`),D++;r.push({operation:"equal",lines:m,oldStart:F,oldCount:B,newStart:b,newCount:D})}return r}function cs(n){if(n.identical)return"";let t=[];t.push(`--- a/${n.filePath}`),t.push(`+++ b/${n.filePath}`);for(let e of n.hunks)t.push(`@@ -${e.oldStart},${e.oldCount} +${e.newStart},${e.newCount} @@`),t.push(...e.lines);return t.join(`
|
|
5
|
+
`)}function xr(n){if(n.identical)return`\x1B[32m\u2713 ${n.filePath} (unchanged)\x1B[0m`;let t=[],e=`+${n.stats.additions} -${n.stats.deletions}`;t.push(`\x1B[1m${n.filePath}\x1B[0m \x1B[90m(${e})\x1B[0m`),t.push("");for(let i of n.hunks){t.push(`\x1B[36m@@ -${i.oldStart},${i.oldCount} +${i.newStart},${i.newCount} @@\x1B[0m`);for(let o of i.lines)if(o.startsWith("+"))t.push(`\x1B[32m${o}\x1B[0m`);else if(o.startsWith("-"))t.push(`\x1B[31m${o}\x1B[0m`);else t.push(`\x1B[90m${o}\x1B[0m`);t.push("")}return t.join(`
|
|
6
|
+
`)}function ls(n){if(n.identical)return`${n.filePath}: unchanged`;return`${n.filePath}: +${n.stats.additions} -${n.stats.deletions} lines`}async function Cr(n,t,e={}){let i="";try{let o=le(n);if(await o.exists())i=await o.text();else if(!e.treatMissingAsEmpty)return bt("",t,n,e)}catch{if(!e.treatMissingAsEmpty)return bt("",t,n,e)}return bt(i,t,n,e)}async function us(n,t={}){let e=new Map;for(let[i,o]of n){let s=await Cr(i,o,t);e.set(i,s)}return e}function vr(n){let t=0,e=0,i=0,o=0,s=0;for(let r of n.values())if(r.identical)e++;else if(t++,i+=r.stats.additions,o+=r.stats.deletions,!r.oldContent)s++;return{totalFiles:n.size,changedFiles:t,unchangedFiles:e,totalAdditions:i,totalDeletions:o,newFiles:s}}function Sr(n){console.log(xr(n))}function fs(n,t=!1){for(let i of n.values()){if(i.identical&&!t)continue;Sr(i)}let e=vr(n);if(console.log(""),console.log(`\x1B[1mSummary:\x1B[0m ${e.totalFiles} files, ${e.changedFiles} changed, ${e.unchangedFiles} unchanged`),e.changedFiles>0)console.log(` \x1B[32m+${e.totalAdditions}\x1B[0m \x1B[31m-${e.totalDeletions}\x1B[0m lines`);if(e.newFiles>0)console.log(` ${e.newFiles} new files`)}
|
|
7
|
+
export{bt,cs,xr,ls,Cr,us,vr,Sr,fs};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var a={debug:0,info:1,warn:2,error:3,silent:4},i="info",u="[dtsx]",L=!1,l=null;function t(o){return a[o]>=a[i]}function d(){if(!L)return"";return`[${new Date().toISOString().slice(11,23)}] `}function v(o,s){let n=d();if(o||n)return[`${n}${o}`,...s];return s}function g(o,s,n){let r=v(s,n);if(l){l(o,...r);return}switch(o){case"debug":console.debug(...r);break;case"info":console.log(...r);break;case"warn":console.warn(...r);break;case"error":console.error(...r);break}}function c(o){return{debug:(...n)=>{if(t("debug"))g("debug",o,n)},info:(...n)=>{if(t("info"))g("info",o,n)},warn:(...n)=>{if(t("warn"))g("warn",o,n)},error:(...n)=>{if(t("error"))g("error",o,n)},setLevel:(n)=>{i=n},getLevel:()=>i,child:(n)=>{let r=o?`${o}:${n}`:`[${n}]`;return c(r)},time:(n)=>{let r=performance.now();return()=>{let f=performance.now()-r;if(t("debug"))g("debug",o,[`${n}: ${f.toFixed(2)}ms`])}},progress:(n)=>{if(t("info"))if(typeof process<"u"&&process.stdout?.isTTY)process.stdout.write(`\r${o} ${n}`);else g("info",o,[n])}}}function
|
|
3
|
-
export{
|
|
2
|
+
var a={debug:0,info:1,warn:2,error:3,silent:4},i="info",u="[dtsx]",L=!1,l=null;function t(o){return a[o]>=a[i]}function d(){if(!L)return"";return`[${new Date().toISOString().slice(11,23)}] `}function v(o,s){let n=d();if(o||n)return[`${n}${o}`,...s];return s}function g(o,s,n){let r=v(s,n);if(l){l(o,...r);return}switch(o){case"debug":console.debug(...r);break;case"info":console.log(...r);break;case"warn":console.warn(...r);break;case"error":console.error(...r);break}}function c(o){return{debug:(...n)=>{if(t("debug"))g("debug",o,n)},info:(...n)=>{if(t("info"))g("info",o,n)},warn:(...n)=>{if(t("warn"))g("warn",o,n)},error:(...n)=>{if(t("error"))g("error",o,n)},setLevel:(n)=>{i=n},getLevel:()=>i,child:(n)=>{let r=o?`${o}:${n}`:`[${n}]`;return c(r)},time:(n)=>{let r=performance.now();return()=>{let f=performance.now()-r;if(t("debug"))g("debug",o,[`${n}: ${f.toFixed(2)}ms`])}},progress:(n)=>{if(t("info"))if(typeof process<"u"&&process.stdout?.isTTY)process.stdout.write(`\r${o} ${n}`);else g("info",o,[n])}}}function ha(o={}){if(o.level)i=o.level;if(o.prefix!==void 0)u=o.prefix;if(o.timestamps!==void 0)L=o.timestamps;if(o.output)l=o.output;return c(u)}var e=c(u);function ya(o){return e.child(o)}function M(o){i=o}function ba(){return i}function wa(o){u=o}function xa(o){L=o}var Ri={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{},setLevel:()=>{},getLevel:()=>"silent",child:()=>Ri,time:()=>()=>{},progress:()=>{}};
|
|
3
|
+
export{ha,e,ya,M,ba,wa,xa,Ri};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{s}from"./chunk-
|
|
3
|
-
export{ve,
|
|
2
|
+
import{s}from"./chunk-egmen4qn.js";function ve(d={}){let{onBuildStart:u=!1,onBuildEnd:f=!0,onGenerated:l,onError:i,...c}=d,o,r,e=async()=>{let t={...c};if(!t.outdir&&o)t.outdir=o;if(!t.entrypoints&&r)t.entrypoints=r;try{let n=await s(t);l?.(n)}catch(n){let a=n instanceof Error?n:Error(String(n));if(i?.(a),!i)console.error("[dtsx] Generation failed:",a.message)}};return{name:"dtsx",esbuildOptions(t){if(t.outdir&&typeof t.outdir==="string")o=t.outdir;if(t.entryPoints){if(Array.isArray(t.entryPoints))r=t.entryPoints;else if(typeof t.entryPoints==="object")r=Object.values(t.entryPoints)}},async buildStart(){if(u)await e()},async buildEnd(t){if(f)await e()}}}var Na=ve,pr=ve,Fa=ve;
|
|
3
|
+
export{ve,Na,pr,Fa};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
class
|
|
3
|
-
`)}async writeResults(){if(!this.config.outputFile)return;let e=this.getResults(),t=JSON.stringify(e,null,2);try{let s=await import("fs/promises");await s.writeFile(this.config.outputFile,t,"utf-8")}catch{await Bun.write(this.config.outputFile,t)}}}function y(){if(typeof process<"u"&&process.memoryUsage){let e=process.memoryUsage();return{timestamp:Date.now(),heapUsed:e.heapUsed,heapTotal:e.heapTotal,external:e.external,arrayBuffers:e.arrayBuffers||0,rss:e.rss}}return{timestamp:Date.now(),heapUsed:0,heapTotal:0,external:0,arrayBuffers:0,rss:0}}function d(){if(typeof process<"u"&&process.cpuUsage){let e=process.cpuUsage();return{user:e.user,system:e.system}}return{user:0,system:0}}function n(e){if(e===0)return"0 B";let t=["B","KB","MB","GB"],s=1024,r=Math.floor(Math.log(e)/Math.log(s));return`${Number.parseFloat((e/s**r).toFixed(2))} ${t[r]}`}function
|
|
4
|
-
export{
|
|
2
|
+
class en{config;memorySamples=[];cpuSamples=[];ioOperations=[];startTime=0;memoryInterval=null;cpuInterval=null;lastCpuUsage=null;isRunning=!1;constructor(e={}){this.config={memory:e.memory??!1,memoryLimit:e.memoryLimit??1024,cpu:e.cpu??!1,samplingInterval:e.samplingInterval??100,io:e.io??!1,trackOperations:e.trackOperations??["read","write"],outputFile:e.outputFile??""}}start(){if(this.isRunning)return;if(this.isRunning=!0,this.startTime=Date.now(),this.memorySamples=[],this.cpuSamples=[],this.ioOperations=[],this.lastCpuUsage=null,this.config.memory)this.sampleMemory(),this.memoryInterval=setInterval(()=>this.sampleMemory(),this.config.samplingInterval);if(this.config.cpu)this.sampleCpu(),this.cpuInterval=setInterval(()=>this.sampleCpu(),this.config.samplingInterval)}stop(){if(!this.isRunning)return;if(this.isRunning=!1,this.memoryInterval)clearInterval(this.memoryInterval),this.memoryInterval=null;if(this.cpuInterval)clearInterval(this.cpuInterval),this.cpuInterval=null}sampleMemory(){let e=y();this.memorySamples.push(e)}sampleCpu(){let e=d();if(this.lastCpuUsage){let t={timestamp:Date.now(),user:e.user-this.lastCpuUsage.user,system:e.system-this.lastCpuUsage.system,total:e.user-this.lastCpuUsage.user+(e.system-this.lastCpuUsage.system)};this.cpuSamples.push(t)}this.lastCpuUsage=e}recordIo(e,t,s,r){if(!this.config.io)return;if(!this.config.trackOperations.includes(e))return;this.ioOperations.push({timestamp:Date.now(),operation:e,path:t,size:s,durationMs:r})}getResults(){let e=Date.now(),t=[],s=this.memorySamples[0]||y(),r=0;for(let a of this.memorySamples){if(r+=a.heapUsed,a.heapUsed>s.heapUsed)s=a;let g=a.heapUsed/1048576;if(g>this.config.memoryLimit)t.push(`Memory limit exceeded at ${new Date(a.timestamp).toISOString()}: ${g.toFixed(2)}MB > ${this.config.memoryLimit}MB`)}let i=this.memorySamples.length>0?r/this.memorySamples.length:0,o=0,m=0;for(let a of this.cpuSamples)o+=a.user,m+=a.system;let u=0,l=0,p=0,h=0,c=0,f=0;for(let a of this.ioOperations)if(a.operation==="read")u++,p+=a.size,c+=a.durationMs;else l++,h+=a.size,f+=a.durationMs;return{startTime:this.startTime,endTime:e,durationMs:e-this.startTime,memory:{samples:this.memorySamples,peak:s,average:{timestamp:0,heapUsed:i,heapTotal:0,external:0,arrayBuffers:0,rss:0},warnings:t},cpu:{samples:this.cpuSamples,totalUser:o,totalSystem:m},io:{operations:this.ioOperations,totalReads:u,totalWrites:l,totalReadBytes:p,totalWriteBytes:h,totalReadMs:c,totalWriteMs:f}}}formatResults(){let e=this.getResults(),t=["=== Profiling Results ===",""];if(t.push(`Duration: ${e.durationMs}ms`),t.push(""),this.config.memory){if(t.push("Memory:"),t.push(` Samples: ${e.memory.samples.length}`),t.push(` Peak heap: ${n(e.memory.peak.heapUsed)}`),t.push(` Average heap: ${n(e.memory.average.heapUsed)}`),e.memory.warnings.length>0){t.push(" Warnings:");for(let s of e.memory.warnings)t.push(` - ${s}`)}t.push("")}if(this.config.cpu)t.push("CPU:"),t.push(` Samples: ${e.cpu.samples.length}`),t.push(` Total user time: ${(e.cpu.totalUser/1000).toFixed(2)}ms`),t.push(` Total system time: ${(e.cpu.totalSystem/1000).toFixed(2)}ms`),t.push("");if(this.config.io)t.push("I/O:"),t.push(` Total reads: ${e.io.totalReads}`),t.push(` Total writes: ${e.io.totalWrites}`),t.push(` Total read: ${n(e.io.totalReadBytes)} in ${e.io.totalReadMs.toFixed(2)}ms`),t.push(` Total write: ${n(e.io.totalWriteBytes)} in ${e.io.totalWriteMs.toFixed(2)}ms`),t.push("");return t.join(`
|
|
3
|
+
`)}async writeResults(){if(!this.config.outputFile)return;let e=this.getResults(),t=JSON.stringify(e,null,2);try{let s=await import("fs/promises");await s.writeFile(this.config.outputFile,t,"utf-8")}catch{await Bun.write(this.config.outputFile,t)}}}function y(){if(typeof process<"u"&&process.memoryUsage){let e=process.memoryUsage();return{timestamp:Date.now(),heapUsed:e.heapUsed,heapTotal:e.heapTotal,external:e.external,arrayBuffers:e.arrayBuffers||0,rss:e.rss}}return{timestamp:Date.now(),heapUsed:0,heapTotal:0,external:0,arrayBuffers:0,rss:0}}function d(){if(typeof process<"u"&&process.cpuUsage){let e=process.cpuUsage();return{user:e.user,system:e.system}}return{user:0,system:0}}function n(e){if(e===0)return"0 B";let t=["B","KB","MB","GB"],s=1024,r=Math.floor(Math.log(e)/Math.log(s));return`${Number.parseFloat((e/s**r).toFixed(2))} ${t[r]}`}function $r(e){return new en(e)}async function ds(e,t){let s=$r({memory:!0,cpu:!0,...t});s.start();try{return{result:await e(),profile:s.getResults()}}finally{s.stop()}}function ps(e){return{async read(t,s){let r=Date.now();try{let i=await s(),o=typeof i==="string"?i.length:0;return e.recordIo("read",t,o,Date.now()-r),i}catch(i){throw e.recordIo("read",t,0,Date.now()-r),i}},async write(t,s,r){let i=Date.now();try{await s(),e.recordIo("write",t,r,Date.now()-i)}catch(o){throw e.recordIo("write",t,0,Date.now()-i),o}}}}class tn{marks=new Map;durations=new Map;mark(e){this.marks.set(e,performance.now())}measure(e,t){let s=this.marks.get(t);if(s===void 0)throw Error(`Mark "${t}" not found`);let r=performance.now()-s,i=this.durations.get(e)||[];return i.push(r),this.durations.set(e,i),r}getDurations(e){return this.durations.get(e)||[]}getAverage(e){let t=this.getDurations(e);if(t.length===0)return 0;return t.reduce((s,r)=>s+r,0)/t.length}getSummary(){let e=new Map;for(let[t,s]of this.durations)e.set(t,{count:s.length,total:s.reduce((r,i)=>r+i,0),average:s.reduce((r,i)=>r+i,0)/s.length,min:Math.min(...s),max:Math.max(...s)});return e}clear(){this.marks.clear(),this.durations.clear()}}function ms(){return new tn}
|
|
4
|
+
export{en,$r,ds,ps,tn,ms};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{r}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{r}from"./chunk-bys9tn88.js";import{l}from"./chunk-6sdswv08.js";import{existsSync as v}from"fs";import{readFile as D}from"fs/promises";import{dirname as N,join as k,resolve as S}from"path";async function Er(e,o=process.cwd()){let i=new Map;for(let t of e){let n=S(o,t),s=await F(n,o);i.set(n,{path:n,dependencies:s,dependents:new Set,state:"pending"})}for(let[t,n]of i)for(let s of n.dependencies){let c=i.get(s);if(c)c.dependents.add(t)}return i}async function F(e,o){let i=new Set;try{let t=await D(e,"utf-8"),n=N(e);for(let s of r(t,e,!1)){let c=s.source;if(!c||!c.startsWith(".")&&!c.startsWith("/"))continue;let a=z(c,n,o);if(a)i.add(a)}}catch{}return i}function z(e,o,i){let t=S(o,e);if(/\.(?:ts|tsx|mts|cts)$/.test(e))return t.includes("node_modules")?null:t;let n=[".ts",".tsx",".mts",".cts"];for(let c of n){let a=`${t}${c}`;if(v(a))return a}for(let c of n){let a=k(t,`index${c}`);if(v(a))return a}let s=`${t}.ts`;return s.includes("node_modules")?null:s}function G(e){let o=[];for(let[i,t]of e){if(t.state!=="pending")continue;let n=!0;for(let s of t.dependencies){let c=e.get(s);if(c&&c.state!=="completed"){n=!1;break}}if(n)o.push(i)}return o}async function I(e,o={}){let i=await D(e,"utf-8"),t=o.keepComments??!0,n=r(i,e,t,o.isolatedDeclarations??!1);return l(n,{filePath:e,sourceCode:i,declarations:n},t,o.importOrder)}async function gs(e,o={}){let i=performance.now(),{maxConcurrency:t=4,rootDir:n=process.cwd(),config:s={},onProgress:c,onError:a}=o,g=await Er(e,n),w=new Map,P=new Map,h=[],x=0,u=0,m=0,b=g.size;while(m<b){let y=G(g);if(y.length===0){let f=[...g.values()].filter((d)=>d.state==="pending");if(f.length>0)for(let d of f)d.state="failed",d.error=Error("Circular dependency detected or dependency failed"),P.set(d.path,d.error),m++;break}let C=y.slice(0,t-u);for(let f of C){let d=g.get(f);d.state="processing",u++}x=Math.max(x,u);let E=C.map(async(f)=>{let d=g.get(f),M=performance.now();try{let p=await I(f,s);d.state="completed",d.result=p,d.duration=performance.now()-M,w.set(f,p),h.push(f)}catch(p){if(d.state="failed",d.error=p instanceof Error?p:Error(String(p)),d.duration=performance.now()-M,P.set(f,d.error),a&&!a(f,d.error))throw Error("Processing aborted by error handler")}finally{u--,m++,c?.(m,b,f)}});await Promise.all(E)}return{success:w,failed:P,totalTimeMs:performance.now()-i,maxConcurrent:x,processingOrder:h}}function hs(e){let o=[],i=new Set,t=new Set;function n(s){if(i.has(s))return;if(t.has(s))return;t.add(s);let c=e.get(s);if(c){for(let a of c.dependencies)if(e.has(a))n(a)}t.delete(s),i.add(s),o.push(s)}for(let s of e.keys())n(s);return o}function kr(e){let o=[];for(let[i,t]of e){let n=!1;for(let s of t.dependencies)if(e.has(s)){n=!0;break}if(!n)o.push(i)}return o}function Tr(e){let o=[],i=new Set;while(i.size<e.size){let t=[];for(let[n,s]of e){if(i.has(n))continue;let c=!0;for(let a of s.dependencies)if(e.has(a)&&!i.has(a)){c=!1;break}if(c)t.push(n)}if(t.length===0){for(let n of e.keys())if(!i.has(n))t.push(n)}for(let n of t)i.add(n);o.push(t)}return o}function ys(e){let o=Tr(e),i=kr(e),t=Math.max(...o.map((s)=>s.length)),n=e.size/o.length;return{totalFiles:e.size,independentFiles:i.length,maxParallelism:t,levels:o.length,estimatedSpeedup:n}}
|
|
3
|
+
export{Er,gs,hs,kr,Tr,ys};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,E,ze,b}from"./chunk-
|
|
3
|
-
export{Fe,
|
|
2
|
+
import{t,E,ze,b}from"./chunk-t5nmnzy6.js";import{Zn,Qn}from"./chunk-6ekemc3h.js";function q(n){return b(n).find((e)=>e.category==="static-import")}function S(n){return t(n).map((e)=>n.slice(e.start,e.end)).join(" ")}function W(n){let e=q(n);return e?n.lastIndexOf(" from ",e.start):-1}function Fe(n){let e=q(n);return e?E(e.specifier,"'"):void 0}function Xn(n){let e=v(n);if(!e)return null;return{defaultName:e.defaultName??e.namespaceName,namedItems:e.namedItems.map((r)=>`${!e.isTypeOnly&&r.isTypeOnly?"type ":""}${r.originalName===r.name?r.name:`${r.originalName} as ${r.name}`}`),source:e.source,isTypeOnly:e.isTypeOnly,isNamespace:e.isNamespace,namespaceName:e.namespaceName,isImportEquals:e.isImportEquals}}function C(n){let e=Zn(n);if(e)return e;let r=v(n),u=r?[r.defaultName,r.namespaceName,...r.namedItems.map((a)=>a.name)].filter((a)=>a!==null):[];return Qn(n,u),u}function w(n){let e=[],r=0;for(let a of t(n)){if(a.kind!=="punctuation"||n.slice(a.start,a.end)!==",")continue;let s=n.slice(r,a.start).trim();if(s)e.push(s);r=a.end}let u=n.slice(r).trim();if(u)e.push(u);return e}function v(n){n=S(n);let e=ze(n);if(e)return{defaultName:e.name,namedItems:[],source:e.source,isTypeOnly:e.isTypeOnly,isNamespace:!1,namespaceName:null,isImportEquals:!0};let r=W(n);if(r===-1)return null;let u=q(n);if(!u)return null;let a=u.specifier,s=n.slice(0,r).trim(),p=u.isTypeOnly;if(s.startsWith("import "))s=s.slice(7).trim();if(p&&s.startsWith("type "))s=s.slice(5).trim();let f=null,o=[],i=!1,m=null,c=s.includes("{")?-1:s.indexOf("* as ");if(c!==-1)return i=!0,m=s.slice(c+5).trim(),f=s.slice(0,c).trim().replace(/,$/,"").trim()||null,{defaultName:f,namedItems:[],source:a,isTypeOnly:p,isNamespace:i,namespaceName:m};let l=s.indexOf("{"),d=s.lastIndexOf("}");if(l!==-1&&d!==-1){let g=s.slice(0,l).trim();if(g.endsWith(","))f=g.slice(0,-1).trim()||null;let I=s.slice(l+1,d),D=w(I);for(let h of D){let T=Li(h),y=T?h.slice(5).trim():h,N=y.lastIndexOf(" as "),O,x;if(N!==-1)x=y.slice(0,N).trim(),O=y.slice(N+4).trim();else O=y,x=y;o.push({name:O,originalName:x,isTypeOnly:p||T,isDefault:!1})}}else f=s.trim()||null;return{defaultName:f,namedItems:o,source:a,isTypeOnly:p,isNamespace:i,namespaceName:m}}function _a(n){let e=n.trim();if(e.startsWith("export default "))return{namedItems:[],source:null,isTypeOnly:!1,isNamespace:!1,isDefault:!0};let r=e.startsWith("export type ");if(e.startsWith("export "))e=e.slice(7).trim();if(r&&e.startsWith("type "))e=e.slice(5).trim();if(e.startsWith("* from ")||e.startsWith("* as ")){let m=e.indexOf(" from "),c=null;if(m!==-1){let l=e.slice(m+6).trim(),d=l[0];if(d==='"'||d==="'"){let g=l.indexOf(d,1);if(g!==-1)c=l.slice(1,g)}}return{namedItems:[],source:c,isTypeOnly:r,isNamespace:!0,isDefault:!1}}let u=e.indexOf("{"),a=e.lastIndexOf("}");if(u===-1||a===-1)return null;let s=null,p=e.indexOf(" from ",a);if(p!==-1){let m=e.slice(p+6).trim(),c=m[0];if(c==='"'||c==="'"){let l=m.indexOf(c,1);if(l!==-1)s=m.slice(1,l)}}let f=[],o=e.slice(u+1,a),i=[];{let m=0;for(let c=0;c<=o.length;c++)if(c===o.length||o.charCodeAt(c)===44){let l=m,d=c;while(l<d&&o.charCodeAt(l)<=32)l++;while(d>l&&o.charCodeAt(d-1)<=32)d--;if(l<d)i.push(o.slice(l,d));m=c+1}}for(let m of i){let c=Li(m),l=c?m.slice(5).trim():m,d=l.lastIndexOf(" as "),g,I;if(d!==-1)I=l.slice(0,d).trim(),g=l.slice(d+4).trim();else g=l,I=l;f.push({name:g,originalName:I,isTypeOnly:r||c,isDefault:!1})}return{namedItems:f,source:s,isTypeOnly:r,isNamespace:!1,isDefault:!1}}function Li(n){let e=t(n),r=e[0];if(!r||r.kind!=="word"||n.slice(r.start,r.end)!=="type"||e.length<2)return!1;return!(e.length===3&&n.slice(e[1].start,e[1].end)==="as")}function ja(n){let e=v(n);if(!e||e.isTypeOnly||e.isImportEquals)return n;if(e.namedItems.every((r)=>r.isTypeOnly))return n.replace(/^import\s+/,"import type ");return n}function Ga(n){let e=new Map,r=[];for(let a of n){let s=v(a);if(!s)continue;if(s.isImportEquals||s.isNamespace){r.push(a);continue}let p=Fe(a);if(!p)throw Error("Cannot locate a grammatical module literal in the import declaration");let f=e.get(s.source)||{types:[],values:[],defaultName:null,sourceLiteral:p};if(s.defaultName)f.defaultName=s.defaultName;for(let o of s.namedItems)if(o.isTypeOnly)f.types.push(o);else f.values.push(o);e.set(s.source,f)}let u=r;for(let{types:a,values:s,defaultName:p,sourceLiteral:f}of e.values())if(a.length===0&&s.length===0&&p)u.push(`import ${p} from ${f};`);else if(a.length>0&&s.length===0&&!p){let o=a.map((i)=>i.originalName===i.name?i.name:`${i.originalName} as ${i.name}`);u.push(`import type { ${o.join(", ")} } from ${f};`)}else if(s.length>0&&a.length===0&&!p){let o=s.map((i)=>i.originalName===i.name?i.name:`${i.originalName} as ${i.name}`);u.push(`import { ${o.join(", ")} } from ${f};`)}else{let o=[];for(let i of a){let m=i.originalName===i.name?i.name:`${i.originalName} as ${i.name}`;o.push(`type ${m}`)}for(let i of s){let m=i.originalName===i.name?i.name:`${i.originalName} as ${i.name}`;o.push(m)}if(p)u.push(`import ${p}, { ${o.join(", ")} } from ${f};`);else u.push(`import { ${o.join(", ")} } from ${f};`)}return u}
|
|
3
|
+
export{Fe,Xn,C,v,_a,Li,ja,Ga};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{r}from"./chunk-
|
|
3
|
-
`);if(e<1||e>o.length||s<1||s>o[e-1].length+1)return null;let n=s-1;for(let i=0;i<e-1;i++)n+=o[i].length+1;return n}function
|
|
2
|
+
import{r}from"./chunk-bys9tn88.js";import{ke}from"./chunk-hgg4aqvf.js";import{readFileSync as u}from"fs";import{readFile as p}from"fs/promises";import{resolve as g}from"path";function m(t){return t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/^\s*\/\/.*$/gm,"").replace(/,\s*([}\]])/g,"$1")}function Ms(t,e){try{return{...JSON.parse(m(u(t,"utf8"))).compilerOptions,...e}}catch(s){throw Error(`Error reading tsconfig.json: ${s instanceof Error?s.message:String(s)}`)}}function f(t,e){let s=e.declarationsOnly?t.filter((o)=>o.endsWith(".d.ts")):t;if(e.include?.length){let o=e.include.map((n)=>new RegExp(n.replace(/\*/g,".*")));s=s.filter((n)=>o.some((i)=>i.test(n)))}if(e.exclude?.length){let o=e.exclude.map((n)=>new RegExp(n.replace(/\*/g,".*")));s=s.filter((n)=>!o.some((i)=>i.test(n)))}return s}async function wt(t,e={}){let s=performance.now(),o=f(t,e),n=[];for(let a of o)try{let c=await p(a,"utf8");for(let l of ke(c))n.push({file:a,line:l.line,column:l.column,message:l.message,code:Number(l.code.slice(4)),severity:"error",category:"Error"})}catch(c){n.push({file:a,line:0,column:0,message:c instanceof Error?c.message:String(c),code:1000,severity:"error",category:"Error"})}let i=e.maxErrors?n.slice(0,e.maxErrors):n;return{success:i.length===0,diagnostics:i,errorCount:i.length,warningCount:0,infoCount:0,filesChecked:o,durationMs:performance.now()-s}}function Lr(t,e={}){return wt(t,{...e,declarationsOnly:!0})}async function Os(t){let e=new Map;for(let s of t){let o=await p(s,"utf8").catch(()=>""),n=[];for(let i of r(o,s,!1,!0))if(i.isExported&&i.kind==="function"&&!i.returnType)n.push({line:1,column:1,message:"Exported function requires an explicit return type",declarationName:i.name,missingAnnotation:"return"});e.set(s,{compatible:n.length===0,issues:n})}return e}function d(t,e,s){let o=t.split(`
|
|
3
|
+
`);if(e<1||e>o.length||s<1||s>o[e-1].length+1)return null;let n=s-1;for(let i=0;i<e-1;i++)n+=o[i].length+1;return n}function Nr(t,e,s){try{let o=u(t,"utf8"),n=d(o,e,s);if(n===null)return null;let i=r(o,t,!1).find((a)=>n>=(a.start??0)&&n<=(a.end??o.length));return i?.typeAnnotation??i?.returnType??i?.text??null}catch{return null}}function Is(t,e,s){let o=Nr(t,e,s);return o?{type:o}:null}function Ls(t){if(t.success)return`\u2713 Type check passed (${t.filesChecked.length} files checked in ${t.durationMs}ms)`;return["\u2717 Type check failed",` ${t.errorCount} error(s), ${t.warningCount} warning(s)`,...t.diagnostics.map((e)=>`\u2717 ${e.file}:${e.line}:${e.column}
|
|
4
4
|
${e.message}`)].join(`
|
|
5
|
-
`)}function
|
|
6
|
-
export{
|
|
5
|
+
`)}function Ns(t){return wt(t.entrypoints.map((e)=>g(t.cwd,e)),{tsconfigPath:t.tsconfigPath,rootDir:t.root})}async function Fs(t,e){let o=(await Promise.all([wt(t),Lr(e)])).flatMap((n)=>n.diagnostics).map((n)=>({sourceName:n.file,sourceType:n.message,dtsType:"<invalid>"}));return{valid:o.length===0,mismatches:o}}
|
|
6
|
+
export{Ms,wt,Lr,Os,Nr,Is,Ls,Ns,Fs};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,m}from"./chunk-
|
|
2
|
+
import{t,m}from"./chunk-t5nmnzy6.js";import{Ge}from"./chunk-gwa4hmfa.js";function ft(l){let u=t(l);if(u.length!==1||u[0].kind!=="word")return;let f=l.slice(u[0].start,u[0].end);return["true","false","null","undefined","this","super"].includes(f)?void 0:f}function Vt(l){let u=t(l);if(u.length===0)return!0;let f=u[u.length-1],g=l.slice(f.start,f.end);if(f.kind==="word"&&(g==="is"||g==="extends"))return!0;if(g==="|"||g==="&")return!0;let o=u[u.length-2];return g===">"&&o!==void 0&&l.slice(o.start,o.end)==="="}function V(l){return C(l,m(l))}function tr(l){for(let u=1024;u<l.length;u*=8){let f=l.slice(0,u),g=I(f,t(f),u);if(g!==void 0)return g}return C(l,t(l))}function C(l,u){return I(l,u,1/0)??!1}function I(l,u,f){let g=0;for(let o=0;o<u.length;o++){let e=u[o];if(e.end>=f)return;if(e.kind==="punctuation"){let a=l.charCodeAt(e.start);if(a===123||a===40||a===91)g++;else if(a===125||a===41||a===93)g--;continue}if(g!==0||e.kind!=="word"||e.end-e.start!==6)continue;let b=l.slice(e.start,e.end);if(b==="export")return!0;if(b==="import"){let a=u[o+1];if(a===void 0?f!==1/0:a.end>=f)return;let w=a?l.slice(a.start,a.end):"";if(w!=="("&&w!==".")return!0}}return f===1/0?!1:void 0}function nr(l){if(l.isExported)return!1;if(["function","variable","interface","type","class","enum","namespace"].includes(l.kind))return!0;return l.kind==="module"&&(l.moduleForm==="namespace"||l.moduleForm==="identifier")}function rr(l,u,f){let g=l.text,o=t(g),e=(s)=>o[s]?g.slice(o[s].start,o[s].end):"",b=(s)=>o[s]?.kind==="word",a=new Map,w=new Map,y=[];for(let s=0;s<o.length;s++){let n=e(s);if(n==="("||n==="["||n==="{"||n==="<")y.push(s);else if(n===")"||n==="]"||n==="}"||n===">"&&e(s-1)!=="="){let i=y.at(-1);if(i!==void 0&&(e(i)==="("&&n===")"||e(i)==="["&&n==="]"||e(i)==="{"&&n==="}"||e(i)==="<"&&n===">")){if(y.pop(),a.set(i,s),e(i)==="<")w.set(s,i)}}}let O=(s)=>{let n=s;while(["readonly","public","private","protected","static","abstract","override","declare","accessor","get","set","async"].includes(e(n))&&(b(n+1)||o[n+1]?.kind==="quoted"||e(n+1)==="["||/^[0-9]/.test(e(n+1))))n++;if(e(n)==="(")return e((a.get(n)??o.length)+1)===":";if(e(n)==="<")return e((a.get(n)??o.length)+1)==="(";let i=n+1;if(e(n)==="[")i=(a.get(n)??o.length)+1;else if(g.charCodeAt(o[n]?.start??g.length)>=48&&g.charCodeAt(o[n]?.start??g.length)<=57)while(i<o.length&&o[i-1].end===o[i].start&&/^[\da-fxob_e.+-]+$/i.test(e(i)))i++;else if(!b(n)&&o[n]?.kind!=="quoted"&&o[n]?.kind!=="literal")return!1;if(e(i)==="?")i++;if(e(i)==="<")i=(a.get(i)??o.length)+1;return e(i)===":"||e(i)==="("},D=[],A=[];for(let s=0;s<o.length;s++){if(e(s)!=="(")continue;let n=a.get(s);if(n===void 0||!(e(n+1)===":"||e(n+1)==="="&&e(n+2)===">"))continue;let i=new Set,h=s+1;while(h<n){let p=h;while(p<n&&e(p)!==","){let x=a.get(p);if(x!==void 0)p=x+1;else p++}let r=h;while(r<p&&e(r)!==":"&&e(r)!=="="){let x=a.get(r);if(x!==void 0)r=x+1;else r++}let c=h;while([".","public","private","protected","readonly","override"].includes(e(c)))c++;if(e(c)==="{"||e(c)==="[")for(let x of Ge(g.slice(o[c].start,o[r-1].end)))i.add(x);else if(b(c))i.add(e(c));h=p+1}let d=n+(e(n+1)===":"?2:3);while(d<o.length){if(d>n+2&&g.slice(o[d-1].end,o[d].start).includes(`
|
|
3
3
|
`)&&!["|","&","?","extends","keyof","typeof","readonly","new","infer","is"].includes(e(d-1))&&O(d))break;if([";",",",")","]","}"].includes(e(d))||e(d)===">"&&e(d-1)!=="=")break;let p=a.get(d);if(p!==void 0)d=p+1;else d++}D.push({start:s,end:d,names:i});let k=w.get(s-1);if(f&&k!==void 0){let p=new Set,r=k+1;while(r<s-1){while(["const","in","out"].includes(e(r)))r++;if(b(r))p.add(e(r));while(r<s-1&&e(r)!==",")r=(a.get(r)??r)+1;r++}A.push({start:k,end:d,names:p})}}let v=f?new Set:void 0,S=(s)=>{if(!b(s))return;v?.add(o[s].start);let n=e(s);if(!D.some((i)=>s>=i.start&&s<i.end&&i.names.has(n)))u.add(n)},T=(s,n)=>{for(let i=s;i<n;i++){if(e(i)==="<"&&a.has(i)){i=a.get(i);continue}if(!b(i)||e(i-1)==="."||e(i+1)===":")continue;if(["true","false","null","undefined","new","this","super","as","satisfies","typeof","void","keyof"].includes(e(i)))continue;S(i)}};for(let s=0;s<o.length;s++){if(e(s)==="typeof")S(s+1);if(e(s)==="export"){let n=s+1;if(e(n)==="default"){if(!["function","class","abstract"].includes(e(n+1))){if(T(n+1,o.length),b(n+1)&&f?.candidates.has(e(n+1))&&(e(n+2)===";"||n+2===o.length))f.references.add(e(n+1))}continue}let i=e(n)==="type";if(i)n++;if(e(n)==="{"){let h=a.get(n);if(h===void 0||e(h+1)==="from")continue;for(let d=n+1;d<h;){let k=e(d)==="type"&&b(d+1)&&e(d+1)!=="as";if(k)d++;let p=f?.candidates.has(e(d));if(p)f.references.add(e(d));if(!p||!i&&!k)S(d);else v?.add(o[d].start);while(d<h&&e(d)!==",")d++;d++}}}if(e(s)==="["){let n=a.get(s);if(n!==void 0&&[":","?","("].includes(e(n+1))&&e(s+2)!==":"&&e(s+2)!=="in")T(s+1,n)}}if(l.kind==="class"){let s=-1;for(let n=0;n<o.length&&e(n)!=="{";n++)if(e(n)==="<"&&a.has(n))n=a.get(n);else if(e(n)==="extends"){s=n;break}if(s!==-1){let n=s+1;while(n<o.length&&e(n)!=="{"&&e(n)!=="implements"){let i=a.get(n);if(i!==void 0)n=i+1;else n++}T(s+1,n)}}if(f){let s=new Set,n=t(l.generics??""),i=0,h=!1;for(let r of n){let c=(l.generics??"").slice(r.start,r.end);if(["<","(","[","{"].includes(c)){if(i++,c==="<"&&i===1)h=!0}else if([">",")","]","}"].includes(c)&&!(c===">"&&(l.generics??"").slice(r.start-1,r.start)==="="))i--;else if(c===","&&i===1)h=!0;else if(h&&i===1&&r.kind==="word"&&!["const","in","out"].includes(c))s.add(c),h=!1}let d=A.flatMap((r)=>[...r.names].flatMap((c)=>[{index:r.start,name:c,delta:1},{index:r.end,name:c,delta:-1}])).sort((r,c)=>r.index-c.index),k=new Map,p=0;for(let r=0;r<o.length;r++){while(p<d.length&&d[p].index<=r){let M=d[p++];k.set(M.name,(k.get(M.name)??0)+M.delta)}if(!b(r)||v?.has(o[r].start)||!f.candidates.has(e(r))||s.has(e(r))||(k.get(e(r))??0)>0)continue;let c=e(r-1),x=e(r+1);if(c==="."||c==="as"&&l.kind==="export"||["const","let","var","function","class","interface","type","enum","namespace","module"].includes(c))continue;if(x===":"&&c!=="?"||x==="?"&&[":","("].includes(e(r+2))||x==="("||x==="<"&&e((a.get(r+1)??o.length)+1)==="(")continue;f.references.add(e(r))}}}
|
|
4
|
-
export{ft,
|
|
4
|
+
export{ft,Vt,V,tr,nr,rr};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{p}from"./chunk-v6fwy63g.js";import{createHash as g}from"crypto";import{mkdir as y,readFile as l,stat as m,writeFile as v}from"fs/promises";import{dirname as C,join as o}from"path";var c="1.0.0",b=".dtsx-cache",d="manifest.json";class
|
|
3
|
-
`)}function
|
|
4
|
-
export{
|
|
2
|
+
import{p}from"./chunk-v6fwy63g.js";import{createHash as g}from"crypto";import{mkdir as y,readFile as l,stat as m,writeFile as v}from"fs/promises";import{dirname as C,join as o}from"path";var c="1.0.0",b=".dtsx-cache",d="manifest.json";class gi{config;manifest=null;dirty=!1;stats={totalEntries:0,hits:0,misses:0,hitRatio:0,sizeBytes:0,timeSavedMs:0};constructor(t={}){this.config={enabled:t.enabled??!0,cacheDir:t.cacheDir??b,format:t.format??"json",maxAge:t.maxAge??86400000,force:t.force??!1,validateCache:t.validateCache??!0}}async init(){if(!this.config.enabled)return;try{await y(this.config.cacheDir,{recursive:!0}),await this.loadManifest()}catch{this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()}}}async loadManifest(){let t=o(this.config.cacheDir,d);try{let e=await l(t,"utf-8");if(this.manifest=JSON.parse(e),this.manifest.version!==c){await this.clear();return}this.stats.totalEntries=Object.keys(this.manifest.entries).length}catch{this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()}}}async save(){if(!this.config.enabled||!this.manifest||!this.dirty)return;let t=o(this.config.cacheDir,d);this.manifest.updatedAt=Date.now(),await v(t,JSON.stringify(this.manifest,null,2)),this.dirty=!1}async get(t,e){if(!this.config.enabled||!this.manifest||this.config.force)return this.stats.misses++,null;let s=this.manifest.entries[t];if(!s)return this.stats.misses++,null;if(s.configHash!==e)return this.stats.misses++,null;if(Date.now()-s.cachedAt>this.config.maxAge)return this.stats.misses++,delete this.manifest.entries[t],this.dirty=!0,null;if(this.config.validateCache)try{let a=(await m(t)).mtimeMs;if(a!==s.mtime){let i=await l(t,"utf-8");if(this.hashContent(i)!==s.hash)return this.stats.misses++,null;s.mtime=a,this.dirty=!0}}catch{return this.stats.misses++,delete this.manifest.entries[t],this.dirty=!0,null}if(s.dependencies.length>0){if((await Promise.all(s.dependencies.map(async(a)=>{let i=this.manifest.entries[a];if(!i)return!0;try{return(await m(a)).mtimeMs===i.mtime}catch{return!1}}))).some((a)=>!a))return this.stats.misses++,null}return this.stats.hits++,this.stats.timeSavedMs+=50,this.updateHitRatio(),s}async set(t,e,s,r,a,i){if(!this.config.enabled||!this.manifest)return;let n=Date.now();try{n=(await m(t)).mtimeMs}catch{}let h={filePath:t,hash:this.hashContent(e),mtime:n,declarations:s,dtsContent:r,dependencies:a,cachedAt:Date.now(),configHash:i};if(!(t in this.manifest.entries))this.stats.totalEntries++;this.manifest.entries[t]=h,this.dirty=!0}invalidate(t){if(!this.manifest)return;delete this.manifest.entries[t],this.dirty=!0;for(let[e,s]of Object.entries(this.manifest.entries))if(s.dependencies.includes(t))delete this.manifest.entries[e]}async clear(){this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()},this.stats={totalEntries:0,hits:0,misses:0,hitRatio:0,sizeBytes:0,timeSavedMs:0},this.dirty=!0,await this.save()}getStats(){return{...this.stats}}hashContent(t){return String(p(t))}updateHitRatio(){let t=this.stats.hits+this.stats.misses;this.stats.hitRatio=t>0?this.stats.hits/t:0}static hashConfig(t){let e={outdir:t.outdir,clean:t.clean,tsconfigPath:t.tsconfigPath};return g("sha256").update(JSON.stringify(e)).digest("hex").slice(0,16)}}function Do(t,e){let s=[],r=[],a=[];return{async needsRebuild(i){return await t.get(i,e)===null},async getCachedDeclarations(i){let n=await t.get(i,e);if(n)return r.push(i),n.declarations;return null},async getCachedDts(i){let n=await t.get(i,e);if(n)return n.dtsContent;return null},async cacheResult(i,n,h,u,f=[]){await t.set(i,n,h,u,f,e),s.push(i)},skip(i){a.push(i)},getResult(){return{rebuilt:s,cached:r,skipped:a,stats:t.getStats()}},async save(){await t.save()}}}async function Po(t,e=604800000){let s=t.getStats();if(s.totalEntries>1000)return await t.clear(),s.totalEntries;return 0}function Ro(t){let e=[];return e.push("Incremental Build Results:"),e.push(` Rebuilt: ${t.rebuilt.length} files`),e.push(` From cache: ${t.cached.length} files`),e.push(` Skipped: ${t.skipped.length} files`),e.push(""),e.push("Cache Statistics:"),e.push(` Total entries: ${t.stats.totalEntries}`),e.push(` Hit ratio: ${(t.stats.hitRatio*100).toFixed(1)}%`),e.push(` Time saved: ~${t.stats.timeSavedMs}ms`),e.join(`
|
|
3
|
+
`)}function Mo(t,e){let s=[],r=/import\s+(?:type\s+)?(?:.+(?:[\n\r\u2028\u2029]\s*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])from\s+)?['"]([^'"]+)['"]/g,a;while((a=r.exec(t))!==null){let i=a[1];if(i.startsWith(".")){let n=o(C(e),i);s.push(n),s.push(`${n}.ts`),s.push(`${n}.tsx`),s.push(o(n,"index.ts")),s.push(o(n,"index.tsx"))}}return s}
|
|
4
|
+
export{gi,Do,Po,Ro,Mo};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{G}from"./chunk-srfpcjtn.js";import{Le,_n}from"./chunk-3d49h0bx.js";import{ue,Gn}from"./chunk-j67chb8m.js";function Mi(){Gn(),_n()}function r(e,t,c=!0,n=!1,o){return Le(e,t,c,n,o)}async function Wn(e,t,c=!0,n={}){return await ue(t,e,n),r(e,t,c)}async function Oi(e,t={}){let c=G(t.concurrency,4),n=new Map;for(let o=0;o<e.length;o+=c){let s=e.slice(o,o+c),i=await Promise.all(s.map(async(a)=>({path:a.filePath,declarations:await Wn(a.sourceCode,a.filePath,a.keepComments,t)})));for(let a of i)n.set(a.path,a.declarations)}return n}
|
|
3
|
+
export{Mi,r,Wn,Oi};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{m}from"./chunk-
|
|
2
|
+
import{m}from"./chunk-t5nmnzy6.js";import{y,ee}from"./chunk-vk5r6pgx.js";function H(b){let f=m(b),e=0,v,I,w,z=[new Map,new Map],n=(t=e)=>f[t]?b.slice(f[t].start,f[t].end):"",d=(t=e)=>f[t]?.kind==="word",g=(t,u)=>/[\r\n]/.test(b.slice(t,u));function r(t){if(n()!==t)return!1;return e++,!0}function k(t){let u=e;for(let a of t)if(!r(a)||e>u+1&&f[e-2].end!==f[e-1].start)return e=u,!1;return!0}function h(t){let u=e;if(t())return!0;return e=u,!1}function o(){if(!d())return!1;return e++,!0}function T(){let t=e,u=e;while(u<f.length&&(u===t||f[u-1].end===f[u].start)){let i=n(u),l=(i==="+"||i==="-")&&/[eE]$/.test(n(u-1));if(!d(u)&&!/^[0-9.]$/.test(i)&&!l)break;u++}if(u===t)return!1;let a=b.slice(f[t].start,f[u-1].end);if(!y(a)&&!ee(a))return!1;return e=u,!0}function A(){if(!["(","[","{"].includes(n()))return!1;if(!v){v=new Map;let u=[];for(let a=0;a<f.length;a++){let i=n(a);if(["(","[","{"].includes(i))u.push(a);else if([")","]","}"].includes(i)){let l=u.pop();if(l!==void 0&&["()","[]","{}"].includes(n(l)+i))v.set(l,a+1);else u.length=0}}}let t=v.get(e);if(t===void 0)return!1;return e=t,!0}function D(){return o()||(n()==="{"||n()==="[")&&A()}function N(){if(!r("("))return!1;if(r(")"))return!0;do{if(k("..."),!D())return!1;if(r("?"),r(":")&&!s())return!1;if(n()===")")break}while(r(",")&&n()!==")");return r(")")}function x(){if(!r("<"))return!1;if(n()===">")return!1;do{if(n()==="const")e++;while((n()==="in"||n()==="out")&&d(e+1)&&n(e+1)!=="extends")e++;if(!o())return!1;if(r("extends")&&!s(!1))return!1;if(r("=")&&!s())return!1;if(n()===">")break}while(r(",")&&n()!==">");return r(">")}function O(){if(!r("<")||n()===">")return!1;do{if(!s())return!1;if(n()===">")break}while(r(",")&&n()!==">");return r(">")}function F(){if(r("abstract"),r("new"),n()==="<"&&!x())return!1;return N()&&k("=>")&&q()}function G(){if(f[e]?.kind!=="literal"||b.charCodeAt(f[e].start)!==96)return!1;for(;;){let t=f[e++];if(!t)return!1;if(b.charCodeAt(t.end-1)===96)return!0;if(b.charCodeAt(t.end-1)!==36||!r("{")||!s()||!r("}"))return!1;if(f[e]?.kind!=="literal")return!1}}function J(){if(!r("["))return!1;if(r("]"))return!0;do{k("...");let t=e;if(d()||f[e]?.kind==="quoted"){if(e++,r("?"),!r(":"))e=t}if(!s())return!1;if(r("?"),n()==="]")break}while(r(",")&&n()!=="]");return r("]")}function q(){if(r("asserts")){if(!o())return!1;return!r("is")||s()}if(d()&&n(e+1)==="is")return e+=2,s();return s()}function S(){if(n()==="<"&&!x())return!1;if(!N())return!1;return!r(":")||q()}function K(){if(!r("["))return!1;if(d()&&(n(e+1)==="in"||n(e+1)===":")){e++;let t=r("in");if(!t&&!r(":"))return!1;if(!s())return!1;if(t&&r("as")&&!s())return!1}else{if(!o()&&!T()){if(f[e]?.kind!=="quoted")return!1;e++}while(r("."))if(!o())return!1}return r("]")}function B(){if(n()==="[")return K();if(o()||T())return!0;if(f[e]?.kind!=="quoted")return!1;return e++,!0}function Q(){if(n()!=="get"&&n()!=="set")return;let t=e++;e=B()&&n()==="("?t+1:t}function L(){if(!r("{"))return!1;while(!r("}")){if(e>=f.length)return!1;let t=e;if((n()==="+"||n()==="-")&&n(e+1)==="readonly")e++;if(n()==="readonly"&&n(e+1)!==":"&&n(e+1)!=="?"&&n(e+1)!=="("&&n(e+1)!==";"&&n(e+1)!=="}")e++;if(n()==="new"&&(n(e+1)==="("||n(e+1)==="<"))e++;if(n()==="("||n()==="<"){if(!S())return!1}else{if(Q(),!B())return!1;if(n()==="+"||n()==="-"){if(e++,!r("?"))return!1}else r("?");if(r(":")){if(!s())return!1}else if(n()==="("||n()==="<"){if(!S())return!1}}if(e===t)return!1;if(r(";")||r(","))continue;if(n()!=="}"&&!g(f[e-1].end,f[e]?.start??b.length))return!1}return!0}function P(){if(h(F))return!0;if(r("("))return s()&&r(")");if(n()==="{")return L();if(n()==="[")return J();if(h(G))return!0;if(f[e]?.kind==="quoted")return e++,!0;if(r("-"))return T();if(h(T))return!0;if(r("typeof")){if(n()==="import")return P();if(!o())return!1;while(r("."))if(!o())return!1;if(n()==="<"&&!O())return!1;return!0}if(r("import")){if(!r("(")||!s())return!1;if(r(",")&&!L())return!1;return r(")")}if(["export","function","class","const","let","var","return","throw","default","new","abstract"].includes(n()))return!1;return o()}function E(){if(n()==="keyof"||n()==="readonly"||n()==="unique")return e++,E();if(r("infer")){if(!o())return!1;if(r("extends")&&!s(!1))return!1;return!0}if(!P())return!1;for(;;)if(r(".")){if(!o())return!1}else if(n()==="<"){if(g(f[e-1].end,f[e].start))return!0;if(!O())return!1}else if(n()==="["){if(g(f[e-1].end,f[e].start))return!0;if(e++,!r("]")&&!(s()&&r("]")))return!1}else return!0}function R(){if(r("&"),!E())return!1;while(r("&"))if(!E())return!1;return!0}function s(t=!0){let u=e,a=z[t?1:0],i=a.get(u);if(i!==void 0){if(i<0)return!1;return e=i,!0}let l=U(t);if(a.set(u,l?e:-1),!l)e=u;return l}function U(t){if(r("|"),!R())return!1;while(r("|"))if(!R())return!1;if(t&&n()==="extends"&&!g(f[e-1].end,f[e].start))return e++,s(!1)&&r("?")&&s()&&r(":")&&s();return!0}function V(){if(n()!=="("||!A())return!1;if(r(":")&&!q())return!1;return k("=>")}function W(){r("async");let t=r("function");if(t){if(r("*"),d())e++}if(n()==="<"&&!x())return!1;if(n()!=="("||!A())return!1;if(r(":")&&!q())return!1;return t?n()==="{":k("=>")}function X(){let t=n();if(t==="<"||t===">"||t==="+"||t==="-")return!1;if(t==="("||f[e]?.kind==="literal"&&b.charCodeAt(f[e].start)===96)return!0;if(!f[e]||g(f[e-1].end,f[e].start))return!0;if(["*","/","%","=","&","|","^","?",":",",",";",")","]","}","in","instanceof","as","satisfies"].includes(t))return!0;if(t==="!")return n(e+1)==="="&&f[e].end===f[e+1]?.start;return!d()&&f[e]?.kind!=="quoted"&&f[e]?.kind!=="literal"&&!["{","[","~","#","@"].includes(t)&&!/^[0-9]$/.test(t)}return(t,u,a)=>{let i=0,l=f.length;while(i<l){let p=i+l>>>1;if(f[p].start<t)i=p+1;else l=p}if(f[i]?.start!==t||n(i)!=="<")return;if(I!==u){I=u,w=void 0;let p=0,M=i;while(p<M){let C=p+M>>>1;if(f[C].start<u)p=C+1;else M=C}if(e=p,W())w=f[e-1].end}if(w!==void 0&&t<w)return{end:w,completeOperand:!1,parameters:!0};e=i;let c=n(i-1),j=t===u||["=","+","-","*","/","%","&","|","^","!","~","?",":","<",">","void","typeof","await","yield","delete"].includes(c);if((c==="function"||c==="class"||c==="*"&&n(i-2)==="function"||d(i-1)&&(n(i-2)==="function"||n(i-2)==="class"||n(i-2)==="*"&&n(i-3)==="function"))&&h(x))return{end:f[e-1].end,completeOperand:!1,parameters:!0};if(e=i,(j||c==="async")&&h(x)){let p=f[e-1].end;if(h(V))return{end:p,completeOperand:!1,parameters:!0}}e=i;let Y=c==="."&&n(i-2)==="?"&&f[i-2].end===f[i-1].start;if((f[i-1]?.end??-1)>=u&&(Y||d(i-1)||c===")"||c==="]"||c==="!"||c===">"&&f[i-1].end===a)&&h(O)&&X())return{end:f[e-1].end,completeOperand:!0};if(e=i,j&&r("<")&&s()&&r(">"))return{end:f[e-1].end,completeOperand:!1};return}}
|
|
3
3
|
export{H};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{e,M}from"./chunk-
|
|
2
|
+
import{e,M}from"./chunk-8vvryt8p.js";import{Ie}from"./chunk-g9emajpc.js";import{s}from"./chunk-egmen4qn.js";import{existsSync as u,readFileSync as w}from"fs";import{dirname as W,join as d,resolve as v}from"path";async function ti(i){let c=[],n=new Set;async function t(a,f){let o=v(a);if(n.has(o))return;if(n.add(o),!u(o)){e.warn(`tsconfig not found: ${o}`);return}try{let p=w(o,"utf-8"),r=JSON.parse(Ie(p)),l=W(o),g=P(l,f),m=[];if(r.references)for(let y of r.references){let h=v(l,y.path),C=u(d(h,"tsconfig.json"))?d(h,"tsconfig.json"):h;await t(C,g);let G=P(W(C),g);m.push(G)}let j="./src";if(r.compilerOptions?.rootDir)j=r.compilerOptions.rootDir;else if(r.include&&r.include.length>0){if(r.include[0].startsWith("src/"))j="./src"}let k="./dist";if(r.compilerOptions?.outDir)k=r.compilerOptions.outDir;else if(r.compilerOptions?.declarationDir)k=r.compilerOptions.declarationDir;c.push({name:g,root:l,tsconfigPath:o,references:m,config:{root:j,outdir:k}})}catch(p){let r=p instanceof Error?p.message:String(p);e.warn(`Failed to parse ${o}: ${r}`)}}return await t(i),c}function P(i,c){let n=d(i,"package.json");if(u(n))try{let a=w(n,"utf-8"),f=JSON.parse(a);if(f.name)return f.name}catch{}let t=i.split("/").pop()||"unknown";return c?`${c}/${t}`:t}function ni(i){let c=new Map(i.map((o)=>[o.name,o])),n=[],t=new Set,a=new Set;function f(o){if(t.has(o))return;if(a.has(o)){e.warn(`Circular dependency detected involving: ${o}`);return}a.add(o);let p=c.get(o);if(p){for(let r of p.references)f(r);n.push(p)}a.delete(o),t.add(o)}for(let o of i)f(o.name);return n}async function bn(i){let c=Date.now(),n=ni(i.projects);e.info(`Generating declarations for ${n.length} projects...`);let t=[],a=!0;for(let r of n){e.info(`
|
|
3
3
|
[${r.name}] Generating...`);try{let l={...i.sharedConfig,...r.config,cwd:r.root,tsconfigPath:r.tsconfigPath},g=await s(l),m=g.filesFailed===0;if(!m)a=!1;t.push({name:r.name,stats:g,success:m}),e.info(`[${r.name}] Generated ${g.filesGenerated} files`)}catch(l){a=!1;let g=l instanceof Error?l.message:String(l);t.push({name:r.name,stats:{generationMode:r.config?.isolatedDeclarations||i.sharedConfig?.isolatedDeclarations?"isolated":"semantic",filesProcessed:0,filesGenerated:0,filesFailed:0,filesValidated:0,validationErrors:0,declarationsFound:0,importsProcessed:0,exportsProcessed:0,durationMs:0,errors:[]},success:!1,error:g}),e.error(`[${r.name}] Failed: ${g}`)}}let f=Date.now()-c,o=t.filter((r)=>r.success).length,p=t.length-o;if(e.info(`
|
|
4
4
|
--- Workspace Generation Summary ---`),e.info(`Projects processed: ${t.length}`),e.info(`Successful: ${o}`),p>0)e.info(`Failed: ${p}`);return e.info(`Total duration: ${f}ms`),e.info(`------------------------------------
|
|
5
|
-
`),{success:a,projects:t,durationMs:f}}async function
|
|
6
|
-
export{
|
|
5
|
+
`),{success:a,projects:t,durationMs:f}}async function uo(i,c){if(c?.logLevel)M(c.logLevel);let n=d(i,"tsconfig.json");if(!u(n))throw Error(`Root tsconfig.json not found at: ${n}`);e.info("Discovering workspace projects...");let t=await ti(n);if(t.length===0)return e.warn("No projects found in workspace"),{success:!0,projects:[],durationMs:0};return e.info(`Found ${t.length} projects`),bn({root:i,projects:t,sharedConfig:c})}async function ri(i){let c=d(i,"package.json");if(!u(c))return[];try{let n=w(c,"utf-8"),t=JSON.parse(n),a=[];if(Array.isArray(t.workspaces))a=t.workspaces;else if(t.workspaces?.packages)a=t.workspaces.packages;return a}catch{return[]}}async function ii(i,c){let{Glob:n}=await Promise.resolve(globalThis.Bun),t=[];for(let a of c){let f=new n(a);for await(let o of f.scan({cwd:i,absolute:!0,onlyFiles:!1})){let p=d(o,"package.json");if(u(p))t.push(o)}}return t}async function fo(i,c){if(c?.logLevel)M(c.logLevel);let n=await ri(i);if(n.length===0)return e.warn("No workspace patterns found in package.json"),{success:!0,projects:[],durationMs:0};e.info(`Found workspace patterns: ${n.join(", ")}`);let t=await ii(i,n);if(t.length===0)return e.warn("No projects found matching workspace patterns"),{success:!0,projects:[],durationMs:0};e.info(`Found ${t.length} workspace packages`);let a=t.map((f)=>{let o=d(f,"tsconfig.json");return{name:P(f),root:f,tsconfigPath:u(o)?o:"",references:[]}});return bn({root:i,projects:a,sharedConfig:c})}
|
|
6
|
+
export{ti,ni,bn,uo,ri,ii,fo};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{L,N}from"./chunk-
|
|
3
|
-
export{Ze,$t,
|
|
2
|
+
import{L,N}from"./chunk-qbk49jz5.js";import{O,I}from"./chunk-fpa2ea8k.js";import{p}from"./chunk-v6fwy63g.js";import{R,F}from"./chunk-6j4wx5mf.js";import{Le}from"./chunk-3d49h0bx.js";import{J,Ee}from"./chunk-dak0dhnx.js";import{l}from"./chunk-6sdswv08.js";function Ze(t,n,r,s,e,i){if(s.length!==1||s[0]!=="bun")return null;if(J(i)==="typescript")return null;let a=L(n??"")?N(t):O(n??"")?I(t):t;return Ee(a,{keepComments:r,isolatedDeclarations:e,engine:i,sourceFile:n})}var y=100,x=0,c=new Map;function $t(t,n,r=!0,s=["bun"],e=!1,i){let a=p(t),b=JSON.stringify([n,r,e,s,J(i)]),g=c.get(b);if(g&&g.contentHash===a)return g.lastAccess=++x,g.result;let h=Ze(t,n,r,s,e,i)??E(t,n,r,s,e);if(c.set(b,{result:h,contentHash:a,lastAccess:++x}),c.size>y){let S=Math.max(1,Math.ceil(c.size*0.1)),u=[];for(let[o,f]of c)u.push([o,f.lastAccess]);u.sort((o,f)=>o[1]-f[1]);for(let o=0;o<S&&o<u.length;o++)c.delete(u[o][0])}return h}function ci(t,n,r=!0,s=["bun"]){return $t(t,n,r,s,!0)}function li(t,n,r=!0,s=["bun"]){return $t(t,n,r,s,!1)}function E(t,n,r,s,e){let i=Le(t,n,r,e);return l(i,{filePath:n??"stdin.ts",sourceCode:t,declarations:i},r,s)}function ui(){c.clear()}function Ba(t,n,r=!0,s=["bun"],e=!1,i){return Ze(t,n,r,s,e,i)??kn(t,n,r,s,e)}function kn(t,n,r=!0,s=["bun"],e=!1){if(L(n??""))t=N(t);else if(O(n??""))t=I(t);let i=e?R(t,n,r):F(t,n,r);return l(i,{filePath:n??"stdin.ts",sourceCode:t,declarations:i},r,s)}
|
|
3
|
+
export{Ze,$t,ci,li,ui,Ba,kn};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import _ from"process";import{existsSync as U}from"fs";import{arch as I,platform as E}from"os";import{fileURLToPath as L}from"url";var T=["native","typescript"];function q(n,t="engine"){if(n===void 0||n===null||n==="")return;if(typeof n==="string"&&T.includes(n))return n;throw Error(`Invalid ${t} ${JSON.stringify(n)}: expected "native" or "typescript"`)}var S;function
|
|
3
|
-
export{q,
|
|
2
|
+
import _ from"process";import{existsSync as U}from"fs";import{arch as I,platform as E}from"os";import{fileURLToPath as L}from"url";var T=["native","typescript"];function q(n,t="engine"){if(n===void 0||n===null||n==="")return;if(typeof n==="string"&&T.includes(n))return n;throw Error(`Invalid ${t} ${JSON.stringify(n)}: expected "native" or "typescript"`)}var S;function hi(n){S=q(n)}function J(n){return q(n)??S??q(_.env.DTSX_ENGINE,"DTSX_ENGINE")??"native"}var b;function w(){return`${E()==="win32"?"windows":E()}-${I()}`}function z(n){let t=[],e=_.env.DTSX_NATIVE_LIBRARY;if(e)t.push(e);for(let r of[`../native/${w()}/${n}`,`../../native/${w()}/${n}`,`../../zig-dtsx/zig-out/lib/${n}`,`../../zig-dtsx/zig-out/bin/${n}`])try{t.push(L(new URL(r,import.meta.url)))}catch{}return t}function B(){if(typeof globalThis.Bun>"u")return null;let n;try{n=import.meta.require("bun:ffi")}catch{return null}let{dlopen:t,FFIType:e,ptr:r,suffix:c,toArrayBuffer:a}=n,g=c==="dll"?`zig-dtsx.${c}`:`libzig-dtsx.${c}`;for(let u of z(g)){if(!U(u))continue;try{let p=t(u,{process_source_checked_v1:{args:[e.ptr,e.u64,e.bool,e.bool,e.ptr,e.ptr],returns:e.ptr},process_source_with_context_v1:{args:[e.ptr,e.u64,e.bool,e.bool,e.ptr,e.u64,e.ptr,e.ptr],returns:e.ptr},free_result:{args:[e.ptr,e.u64],returns:e.void}}),{symbols:l}=p,f=new TextDecoder;return{checked:(i,o,d,m,y,h)=>l.process_source_checked_v1(r(i),o,d,m,r(y),r(h)),contextual:(i,o,d,m,y,h,A,N)=>l.process_source_with_context_v1(r(i),o,d,m,r(y),h,r(A),r(N)),read:(i,o)=>{if(!i)return"";let d=o?f.decode(a(i,0,o)):"";return l.free_result(i,o),d}}}catch{continue}}return null}function k(){if(b===void 0)b=B();return b}function yi(n){return J(n)==="native"&&k()!==null}var D=new TextEncoder,s=new Uint8Array(65536),x=new BigUint64Array(1),v=new Uint32Array(1);function Ee(n,t){if(J(t.engine)==="typescript")return null;let e=k();if(!e)return null;if(n.length*3>s.length)s=new Uint8Array(n.length*3);let{written:r}=D.encodeInto(n,s),c=t.sourceFile!==void 0||(t.inferenceSources?.size??0)>0||(t.augmentationImports?.size??0)>0,a;if(c){let u=t.sourceFile??"source.ts",p=D.encode(JSON.stringify({version:1,moduleSpecifierMode:"preserve",sourceFile:u,outputFile:u.replace(/\.(?:[cm]?[jt]sx?|vue|stx)$/,".d.ts"),sourceHash:new Bun.CryptoHasher("sha256").update(s.subarray(0,r)).digest("hex"),rewrites:[],augmentationImports:[...t.augmentationImports??[]],inferenceSources:[...t.inferenceSources??[]].map(([l,f])=>({specifier:l,source:f}))}));a=e.contextual(s,r,t.keepComments,t.isolatedDeclarations,p,p.length,x,v)}else a=e.checked(s,r,t.keepComments,t.isolatedDeclarations,x,v);let g=Number(x[0]);if(v[0]!==0)return e.read(a,g),null;return e.read(a,g)}
|
|
3
|
+
export{q,hi,J,yi,Ee};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{w,le,Mt,u}from"./chunk-
|
|
2
|
+
import{w,le,Mt,u}from"./chunk-6b6rt0yh.js";import{G}from"./chunk-srfpcjtn.js";import{L,N}from"./chunk-qbk49jz5.js";import{O,I}from"./chunk-fpa2ea8k.js";import{r}from"./chunk-bys9tn88.js";import{Re}from"./chunk-j4w3zxc1.js";import{e,M}from"./chunk-8vvryt8p.js";import{Oe,P,Bn,Z}from"./chunk-1t77gtcx.js";import{Rn}from"./chunk-87mk4nnk.js";import{et,kt}from"./chunk-h6ddkhyq.js";import{D}from"./chunk-rc1zpm7f.js";import{De,oe,X,Pe}from"./chunk-1k5r7bpf.js";import{tt,Y,re,Tt,At,Dt,Pt}from"./chunk-x569v6av.js";import{ne,$e}from"./chunk-193aw7d6.js";import{Qe,Et}from"./chunk-tgaear7n.js";import{te}from"./chunk-spdw3tc0.js";import{Ln,rt}from"./chunk-geqq4mmz.js";import{q,Ee}from"./chunk-dak0dhnx.js";import{Xe}from"./chunk-msa98cgm.js";import{Ae}from"./chunk-7pw9ayve.js";import{l}from"./chunk-6sdswv08.js";import{ie,Rt}from"./chunk-0d5nemtn.js";import{mkdir as ye}from"fs/promises";import{availableParallelism as Se}from"os";import{basename as fe,dirname as pe,relative as V,resolve as ee}from"path";var Q=new WeakMap,ce=new WeakMap;function se(d){let a=Q.get(d);if(!a)a=Oe(d),Q.set(d,a),a.catch(()=>Q.delete(d));return a}async function de(d,a,t,f,h,g=Y){let o=fe(d)||"output.d.ts",C=V(pe(d),a),T=`${o}.map`,j=t.lastIndexOf(`
|
|
3
3
|
${tt()}`),p=j===-1?t:t.slice(0,j),y=Dt(p,o,C,f),b=`${d}.map`;return await g(b,JSON.stringify(y)),e.debug(` Generated source map: ${V(h,b)}`),T}async function s(d){let a=Date.now(),t={...D,...d};if(t.logLevel)M(t.logLevel);else if(t.verbose)M("debug");let f=new Ae;if(t.plugins&&t.plugins.length>0){for(let n of t.plugins)f.register(n),e.debug(`Registered plugin: ${n.name}`);t=await f.runOnStart(t)}if(t.moduleSpecifierMode!==void 0&&t.moduleSpecifierMode!=="preserve"&&t.moduleSpecifierMode!=="node")throw Error("moduleSpecifierMode must be preserve or node");if(q(t.engine,"engine"),await ne(t),t.isolatedDeclarations===void 0)t.isolatedDeclarations=await re(t);let h=t.typeMappings?ie(t.typeMappings):void 0,g=null,o={generationMode:t.isolatedDeclarations?"isolated":"semantic",filesProcessed:0,filesGenerated:0,filesFailed:0,filesValidated:0,validationErrors:0,declarationsFound:0,importsProcessed:0,exportsProcessed:0,durationMs:0,errors:[]},C=0;e.debug("Starting DTS generation..."),e.debug(`Using ${o.generationMode} declaration generation path`),e.debug("Config:",t);let T=await De(t,()=>se(t)),j=T.entryFiles,p=[...T.files],{resolver:y,reachability:b}=T;if(ce.set(t,new Set(p)),t.incremental){let n=T.getResolutionFingerprint();if(!t.isolatedDeclarations){let i=new Set(p),m=new Map;for(let S of p){let F=await u(S);m.set(S,rt(F));for(let U of P(F,{includeImports:!0})){let R=y(U.specifier,S).resolved;if(R&&!R.split(/[/\\]/).includes("node_modules")&&!i.has(R))i.add(R),m.set(R,rt(await u(R)))}}let c=[...m].sort(([S],[F])=>S.localeCompare(F));n=JSON.stringify([n,c])}if(g=new et(t,n),t.clearCache){if(e.debug("Clearing build cache..."),!t.dryRun)g.clear()}else if(g.load()){let m=g.getStats();e.debug(`Loaded build cache with ${m.entries} entries`)}else e.debug("No existing build cache found, starting fresh");if(!t.dryRun)kt(t.cwd)}if(g&&!t.dryRun){let n=g.prune(new Set(p),t.cwd);if(n>0)e.debug(`Pruned ${n} deleted files from cache`)}if(e.debug(`Found ${p.length} TypeScript files`),t.progress&&p.length>0){let n=t.parallel?"parallel":"sequential";e.info(`Processing ${p.length} files (${n})...`)}let k=new Map,z=new Map,v=async(n,i,m="lf")=>{z.set(n,{content:i,lineEnding:m})},E=async(n,i)=>{let m;try{let c=X(n,t),S=async(x)=>{if(!t.diff)return;try{let B=await u(c),H=At(B,x,V(t.cwd,c));if(H)e.info(`
|
|
4
4
|
${H}`);else e.debug(`[no changes] ${c}`)}catch{e.info(`[new file] ${V(t.cwd,c)}`)}},F=(x)=>{if(!t.validate)return 0;let B=Tt(x,c);if(B.isValid)return e.debug(`[validation] ${c} - OK`),0;e.warn(`[validation] ${V(t.cwd,c)} has ${B.errors.length} error(s):`);for(let H of B.errors){let ae=` Line ${H.line}:${H.column}`;if(H.code)ae+=` [${H.code}]`;if(ae+=` - ${H.message}`,e.warn(ae),H.suggestion)e.warn(` Suggestion: ${H.suggestion}`)}return B.errors.length},U=(x)=>{e.info(`[dry-run] Would generate: ${c}`),e.debug("--- Content preview ---"),e.debug(x.slice(0,500)+(x.length>500?`
|
|
5
5
|
...`:"")),e.debug("--- End preview ---")};if(g){let x=g.getCachedIfValid(n,t.cwd);if(x){if(t.bundle)k.set(n,x);await S(x);let B=F(x);if(t.dryRun)U(x);else{if(t.declarationMap)m=i??await u(n),await de(c,n,x,m,t.cwd,v);await v(c,x,t.lineEnding)}return e.debug(`[cached] ${V(t.cwd,c)}`),{success:!0,file:n,declarationCount:0,importCount:0,exportCount:0,cached:!0,validationErrorCount:B}}}m=i??await u(n);let{content:R,declarationCount:he,importCount:we,exportCount:Ce}=await ge(n,m,t,f,h,T.augmentationImports.get(n));if(t.bundle)k.set(n,R);let A=R;if(t.prettier||t.indentStyle||t.indentSize){let x=await te(A,{usePrettier:t.prettier,builtIn:{indentSize:t.indentSize||2,useTabs:t.indentStyle==="tabs",normalizeWhitespace:!0,sortImports:!0,trailingNewline:!0}},c);A=x.content;for(let B of x.warnings??[])e.warn(`[format] ${B}`)}if(t.declarationMap){let x=`${fe(c)||"output.d.ts"}.map`;A=Pt(A,x)}await S(A);let be=F(A);if(t.dryRun)U(A);else{if(t.declarationMap&&m)await de(c,n,A,m,t.cwd,v);if(await v(c,A,t.lineEnding),g&&m)g.update(n,m,A,t.cwd);e.debug(`Generated: ${c}`)}return{success:!0,file:n,declarationCount:he,importCount:we,exportCount:Ce,validationErrorCount:be}}catch(c){let S=Qe(c,n,m);if(t.plugins&&t.plugins.length>0)await f.runOnError(c instanceof Error?c:Error(String(c)),n,m||"");return{success:!1,file:n,declarationCount:0,importCount:0,exportCount:0,dtsError:S,validationErrorCount:0}}},W=t.parallel||t.parallel!==!1&&p.length>=10,J=G(t.concurrency,Se?.()??8),_=new Map;if(W&&p.length>1){let n=p.map(async(i)=>{try{let m=await u(i);return{file:i,source:m}}catch{return{file:i,source:null}}});for(let i of await Promise.all(n))if(i.source!==null)_.set(i.file,i.source)}let K=(n)=>{if(o.filesProcessed++,n.success){if(n.cached)C++;else o.filesGenerated++,o.declarationsFound+=n.declarationCount,o.importsProcessed+=n.importCount,o.exportsProcessed+=n.exportCount;if(t.validate){if(o.filesValidated++,n.validationErrorCount)o.validationErrors+=n.validationErrorCount}}else if(o.filesFailed++,n.dtsError){o.errors.push(n.dtsError);let i=Et(n.dtsError);if(t.continueOnError)e.warn(i);else throw e.error(i),Error(n.dtsError.message)}};if(W)for(let n=0;n<p.length;n+=J){let i=p.slice(n,n+J),m=await Promise.all(i.map((c)=>E(c,_.get(c))));for(let c of m)K(c);if(t.progress){let c=Math.round(o.filesProcessed/p.length*100);e.info(`[${o.filesProcessed}/${p.length}] ${c}%`)}}else for(let n of p){let i=await E(n);if(K(i),t.progress){let m=Math.round(o.filesProcessed/p.length*100),c=i.cached?"[cached]":"";e.info(`[${o.filesProcessed}/${p.length}] ${m}% - ${V(t.cwd,n)} ${c}`)}}if(!t.bundle){let n=[];if(b)for(let i of b.unresolved)n.push({from:i.from,specifier:i.specifier,reason:"missing"});if(t.autoIncludeReExports===!1&&p.length>0){let i=new Set(p);for(let m of p){let c;try{c=await u(m)}catch{continue}for(let S of P(c)){let F=y(S.specifier,m);if(!F.isRelative)continue;if(!F.resolved)n.push({from:m,specifier:S.specifier,reason:"missing"});else if(!/\.d\.(?:ts|mts|cts)$/.test(F.resolved)&&!i.has(F.resolved))n.push({from:m,specifier:S.specifier,reason:"not-emitted"})}}}if(n.length>0){let i=[];i.push(`Found ${n.length} re-export(s) pointing at siblings that won't be in the output:`);for(let c of n){let S=V(t.cwd,c.from);if(c.reason==="missing")i.push(` ${S} \u2192 '${c.specifier}' (path not found on disk)`);else i.push(` ${S} \u2192 '${c.specifier}' (resolved but not in entrypoints; set autoIncludeReExports: true or add to entrypoints)`)}let m=i.join(`
|
|
6
|
-
`);if(t.failOnUnresolvedReExport)throw Error(m);e.warn(m),e.warn('Generated .d.ts files reference modules that were not emitted \u2014 consumers will see "has no exported member" errors.')}}if(t.bundle&&(o.filesGenerated>0||C>0)&&j.length>0)try{e.debug("Bundling declarations...");let n=j.length===1&&!!t.bundleOutput;for(let i of j){let m=await Z([i],{includeImports:!0,resolveSpecifier:y}),c=new Set;for(let R of m.reachable){if(R.endsWith(".d.ts"))continue;if(R.includes("node_modules"))continue;c.add(R)}let S=p.filter((R)=>c.has(R));if(!S.includes(i))S.push(i);let F=
|
|
6
|
+
`);if(t.failOnUnresolvedReExport)throw Error(m);e.warn(m),e.warn('Generated .d.ts files reference modules that were not emitted \u2014 consumers will see "has no exported member" errors.')}}if(t.bundle&&(o.filesGenerated>0||C>0)&&j.length>0)try{e.debug("Bundling declarations...");let n=j.length===1&&!!t.bundleOutput;for(let i of j){let m=await Z([i],{includeImports:!0,resolveSpecifier:y}),c=new Set;for(let R of m.reachable){if(R.endsWith(".d.ts"))continue;if(R.includes("node_modules"))continue;c.add(R)}let S=p.filter((R)=>c.has(R));if(!S.includes(i))S.push(i);let F=Rn(i,S,k,{cwd:t.cwd,keepComments:t.keepComments});for(let R of new Set(F.warnings))e.warn(`[bundle] ${R}`);let U=n?ee(t.cwd,t.outdir,t.bundleOutput):X(i,t);if(t.dryRun)e.info(`[dry-run] Would bundle ${F.files.length} files to: ${V(t.cwd,U)}`);else await v(U,F.content,t.lineEnding),e.debug(`Prepared ${F.files.length} bundled files for: ${V(t.cwd,U)}`);if(n)break}}catch(n){let i=n instanceof Error?n.message:String(n);throw e.error(`Bundle failed: ${i}`),n}if(!t.dryRun)await $e(t,z);if(g&&!t.dryRun)g.save(),e.debug("Saved build cache");if(o.durationMs=Date.now()-a,t.stats)if(t.outputFormat==="json")console.log(JSON.stringify(o,null,2));else{if(e.info(`
|
|
7
7
|
--- Generation Statistics ---`),e.info(`Files processed: ${o.filesProcessed}`),e.info(`Files generated: ${o.filesGenerated}`),C>0)e.info(`Files cached: ${C}`);if(o.filesFailed>0)e.info(`Files failed: ${o.filesFailed}`);if(e.info(`Declarations found: ${o.declarationsFound}`),e.info(`Imports processed: ${o.importsProcessed}`),e.info(`Exports processed: ${o.exportsProcessed}`),o.filesValidated>0){if(e.info(`Files validated: ${o.filesValidated}`),o.validationErrors>0)e.info(`Validation errors: ${o.validationErrors}`)}if(e.info(`Duration: ${o.durationMs}ms`),o.errors.length>0){e.info(`
|
|
8
8
|
Errors:`);for(let n of o.errors){let i=` - ${n.file}`;if(n.location)i+=`:${n.location.line}:${n.location.column}`;if(n.code)i+=` [${n.code}]`;if(i+=`: ${n.message}`,e.info(i),n.suggestion)e.info(` Suggestion: ${n.suggestion}`)}}e.info(`-----------------------------
|
|
9
|
-
`)}if(t.plugins&&t.plugins.length>0)await f.runOnEnd(o);return e.debug("DTS generation complete!"),o}async function ve(d,a,t){let f=await se(t),h=Pe(a,t,f,ce.get(t));return
|
|
10
|
-
`)){if(!h||h.startsWith(" ")||h.startsWith("\t")||h.startsWith("}")||h.startsWith("*")||h.startsWith("/"))continue;if(a++,h.startsWith("import "))t++;else if(h.startsWith("export "))f++}return{declarationCount:a,importCount:t,exportCount:f}}function Me(d,a,t,f,h){let g=t.importOrder??["bun"];if(g.length!==1||g[0]!=="bun")return null;let o=L(a)?N(d):O(a)?I(d):d;return Ee(o,{keepComments:t.keepComments??!0,isolatedDeclarations:t.isolatedDeclarations??!1,engine:t.engine,sourceFile:a,inferenceSources:f,augmentationImports:h})}async function ue(d,a,t,f,h,g,o){let C=await ve(d,a,f);if(g)C=Rt(C,g,{filePath:a});if(f.normalizeOutput===!0||f.declarationOrder)C=Xe(C,{lineEnding:"lf",declarationOrder:f.declarationOrder,indent:{style:f.indentStyle??"spaces",size:f.indentSize??2}});if(h)C=await h.runOnAfterFile(a,t,C);return{content:C,...o}}async function
|
|
9
|
+
`)}if(t.plugins&&t.plugins.length>0)await f.runOnEnd(o);return e.debug("DTS generation complete!"),o}async function ve(d,a,t){let f=await se(t),h=Pe(a,t,f,ce.get(t));return Bn(d,(g)=>h(g).emittedSpecifier)}async function po(d,a){Q.delete(a),ce.delete(a);let t=await se(a),f=await Z([d],{includeImports:!0,resolveSpecifier:t}),h=await Re([...f.sources.keys()],t,a.isolatedDeclarations??!1,f.sources);return(await me(d,a,void 0,h.get(ee(d)))).content}async function me(d,a,t,f){let h=await u(d),g=a.typeMappings?ie(a.typeMappings):void 0;return ge(d,h,a,t,g,f)}async function ge(d,a,t,f,h,g){let o=a;if(f)o=await f.runOnBeforeFile(d,a);let C=new Map;if(!t.isolatedDeclarations){let v=await se(t);for(let E of P(o,{includeImports:!0})){let W=v(E.specifier,d).resolved;if(W&&!W.split(/[/\\]/).includes("node_modules"))C.set(E.specifier,await u(W))}}let T=f?.hasDeclarationHooks()?null:Me(o,d,t,C,g);if(T!==null)return ue(T,d,o,t,f,h,xe(T));let j=C.size?Ln(o,C):void 0,p=r(o,d,t.keepComments,t.isolatedDeclarations??!1,j);if(f)p=await f.runOnDeclarations(d,o,p);let y=0,b=0;for(let v=0;v<p.length;v++){let E=p[v];if(E.kind==="import")y++;if(E.kind==="export"||E.isExported)b++}let z=l(p,{filePath:d,sourceCode:o,declarations:p,augmentationImports:g},t.keepComments,t.importOrder);return ue(z,d,o,t,f,h,{declarationCount:p.length,importCount:y,exportCount:b})}function xe(d){let a=0,t=0,f=0;for(let h of d.split(`
|
|
10
|
+
`)){if(!h||h.startsWith(" ")||h.startsWith("\t")||h.startsWith("}")||h.startsWith("*")||h.startsWith("/"))continue;if(a++,h.startsWith("import "))t++;else if(h.startsWith("export "))f++}return{declarationCount:a,importCount:t,exportCount:f}}function Me(d,a,t,f,h){let g=t.importOrder??["bun"];if(g.length!==1||g[0]!=="bun")return null;let o=L(a)?N(d):O(a)?I(d):d;return Ee(o,{keepComments:t.keepComments??!0,isolatedDeclarations:t.isolatedDeclarations??!1,engine:t.engine,sourceFile:a,inferenceSources:f,augmentationImports:h})}async function ue(d,a,t,f,h,g,o){let C=await ve(d,a,f);if(g)C=Rt(C,g,{filePath:a});if(f.normalizeOutput===!0||f.declarationOrder)C=Xe(C,{lineEnding:"lf",declarationOrder:f.declarationOrder,indent:{style:f.indentStyle??"spaces",size:f.indentSize??2}});if(h)C=await h.runOnAfterFile(a,t,C);return{content:C,...o}}async function mo(d){let a={...D,...d};if(a.logLevel)M(a.logLevel);let t=ee(a.cwd,a.root),f=150,h=5,g=1e4,o={pendingChanges:new Set,debounceTimer:null,isProcessing:!1,errorCount:0,lastErrorTime:0};e.info(`Watching for changes in ${t}...`),e.info(`Press Ctrl+C to stop
|
|
11
11
|
`);try{await s(a),e.info(`[watch] Initial generation complete
|
|
12
12
|
`)}catch(y){let b=y instanceof Error?y.message:String(y);e.error(`[watch] Initial generation failed: ${b}`),e.info(`[watch] Continuing to watch for changes...
|
|
13
13
|
`)}async function C(){if(o.isProcessing||o.pendingChanges.size===0)return;let y=Date.now();if(o.errorCount>=h){if(y-o.lastErrorTime<g){e.warn(`[watch] Too many errors, pausing for ${Math.ceil((g-(y-o.lastErrorTime))/1000)}s...`);return}o.errorCount=0}o.isProcessing=!0;let b=Array.from(o.pendingChanges);o.pendingChanges.clear();let k=new Date().toLocaleTimeString();if(b.length===1)e.info(`
|
|
@@ -28,4 +28,4 @@ Errors:`);for(let n of o.errors){let i=` - ${n.file}`;if(n.location)i+=`:${n.lo
|
|
|
28
28
|
`],{stdout:"pipe",stderr:"inherit"});if(w){let y=p.stdout.getReader(),b=new TextDecoder,k="";while(!0){let{done:z,value:v}=await y.read();if(z)break;k+=b.decode(v,{stream:!0});let E=k.split(`
|
|
29
29
|
`);k=E.pop()||"";for(let W of E)if(W.startsWith("CHANGED:")){let J=W.slice(8);T(J)}}}else{let y=p.stdout,b="";y.on("data",(k)=>{b+=k.toString();let z=b.split(`
|
|
30
30
|
`);b=z.pop()||"";for(let v of z)if(v.startsWith("CHANGED:")){let E=v.slice(8);T(E)}}),await p.exited}}
|
|
31
|
-
export{s,
|
|
31
|
+
export{s,po,mo};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ot,It,c,Ne,ot,Lt,Nt,at,ct,lt,Ft,ut,Bt,Wt}from"./chunk-
|
|
2
|
+
import{Ot,It,c,Ne,ot,Lt,Nt,at,ct,lt,Ft,ut,Bt,Wt}from"./chunk-qbk49jz5.js";function O(t){return t.endsWith(".stx")}function h(t){let n=[],s=/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,o;while((o=s.exec(t))!==null){let r=o[1]??"",i=/\blang\s*=\s*["']([^"']+)["']/i.exec(r)?.[1]?.toLowerCase()??(/\b(?:type\s*=\s*["'](?:text\/)?typescript["']|typescript)\b/i.test(r)?"ts":"js"),e=/\bserver\b/i.test(r)?"server":/\bclient\b/i.test(r)?"client":"universal";n.push({content:o[2]??"",kind:"script",attrs:r,context:e,lang:i,start:o.index})}return n}function y(t){let n=[],s=/^[ \t]*@ts[ \t]*(?:\r?\n|$)/gm,o;while((o=s.exec(t))!==null){let r=s.lastIndex,i=/^[ \t]*@endts[ \t]*(?:\r?\n|$)/gm;i.lastIndex=r;let e=i.exec(t),l=e?.index??t.length;if(n.push({content:t.slice(r,l),kind:"ts",attrs:"",context:"universal",lang:"ts",start:o.index}),!e)break;s.lastIndex=i.lastIndex}return n}function Ca(t){return[...h(t),...y(t)].sort((n,s)=>n.start-s.start)}function k(t){if(t.kind==="ts"||t.context!=="universal"||t.lang==="ts")return!0;return/\b(?:defineProps|defineEmits|defineExpose|defineSlots)\b|\bexport\s|\b(?:interface|type)\s+[A-Za-z_$]/.test(t.content)}function _(t){let n=/(?:\$?props)\s+as\s+/g,s;while((s=n.exec(t))!==null){let o=n.lastIndex;while(o<t.length&&/\s/.test(t[o]))o++;if(t[o]==="{"){let e=c(t,o,"{","}");if(e!==-1)return t.slice(o,e+1).trim();continue}let r=/^[A-Za-z_$][\w$]*/.exec(t.slice(o))?.[0];if(!r)continue;let i=o+r.length;while(i<t.length&&/\s/.test(t[i]))i++;if(t[i]==="<"){let e=c(t,i,"<",">");if(e!==-1)i=e+1}return t.slice(o,i).trim()}return null}function w(t){return/\b(?:const|let|var)\s+\$?props\s*:\s*([^=;\n]+)/.exec(t)?.[1]?.trim()??null}function T(t){let n=/^\s*(?:\|\||\?\?)\s*([^;\n]+)/.exec(t)?.[1]?.trim();if(/^['"`]/.test(n??""))return"string";if(/^(?:true|false)\b/.test(n??""))return"boolean";if(/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)\b/.test(n??""))return"number";if(/^\[/.test(n??""))return"unknown[]";if(/^\{/.test(n??""))return"Record<string, unknown>";if(/^\s*(?:===?|!==?)\s*(?:true|false)\b/.test(t))return"boolean";return"unknown"}function E(t,n){if(!t||t==="unknown")return n;if(n==="unknown"||t===n)return t;return[...new Set([...t.split(" | "),...n.split(" | ")])].join(" | ")}function P(t){let n=It(t),s=new Map,o=/\$props(?:\.([A-Za-z_$][\w$]*)|\[\s*(['"])([^'"\n]+)\2\s*\])/g,r;while((r=o.exec(t))!==null){if(n.slice(r.index,r.index+6)!=="$props")continue;let e=r[1]??r[3],l=T(t.slice(o.lastIndex));s.set(e,E(s.get(e),l))}if(s.size===0)return null;return{type:`{ ${[...s].map(([e,l])=>`${/^[A-Za-z_$][\w$]*$/.test(e)?e:JSON.stringify(e)}?: ${l}`).join(", ")} }`}}function v(t){let n=ut(t,null);if(n)return n;let s=_(t)??w(t);if(!s)return P(t);if(/^[A-Za-z_$][\w$]*$/.test(s)){let o=s.replace(/[$]/g,"\\$&");if(new RegExp(`\\bexport\\s+(?:declare\\s+)?(?:interface|type)\\s+${o}\\b`).test(t))return{type:s}}return ut(`${t}
|
|
3
3
|
defineProps<${s}>()`,null)}function A(t){return Lt(t)}function S(t){let n=It(t).trimStart();if(n==="")return!0;return/^(?:import\b|export\b|declare\b|interface\b|type\b|(?:export\s+)?namespace\b|(?:export\s+)?module\b|(?:abstract\s+)?class\b|const\b|let\b|var\b|(?:async\s+)?function\b)/.test(n)}function C(t){let n=[],s=0,o=0,r=0;while(r<t.length){let e=t[r],l=Ot(t,r);if(l>r){r=l;continue}if(e==="{"||e==="["||e==="(")o++;else if(e==="}"||e==="]"||e===")")o=Math.max(0,o-1);if((e===";"||e===`
|
|
4
|
-
`)&&o===0){let a=r+1;if(!S(t.slice(s,a)))n.push([s,a]);s=a}r++}if(s<t.length&&!S(t.slice(s)))n.push([s,t.length]);let i=t;for(let e=n.length-1;e>=0;e--)i=i.slice(0,n[e][0])+i.slice(n[e][1]);return i}function I(t){let s=
|
|
4
|
+
`)&&o===0){let a=r+1;if(!S(t.slice(s,a)))n.push([s,a]);s=a}r++}if(s<t.length&&!S(t.slice(s)))n.push([s,t.length]);let i=t;for(let e=n.length-1;e>=0;e--)i=i.slice(0,n[e][0])+i.slice(n[e][1]);return i}function I(t){let s=Ca(t).filter(k).map((f)=>f.content).join(`
|
|
5
5
|
`),o=null,r=Nt(s);if(r.passthrough)return s;if(s=r.script,r.options){let f=at(r.options,"props");if(f)o=ot(f)}let i=s,e=A(s),l=v(i),a=l?.type??o??"{}",m=Bt(i,null),d=Wt(i,null),g=Ne(i,"defineSlots")?.generic??null,x=l?.inlinedLocal;if(x)e=lt(e,x.name,x.declText);let p=`DefineComponent<${a}>`,u=[];if(m)u.push(`readonly __stxEmits?: ${m}`);if(g)u.push(`readonly __stxSlots?: ${g}`);if(d)u.push(`readonly __stxExposed?: ${d}`);if(u.length>0)p+=` & { ${u.join(", ")} }`;p=Ft(p),e=C(ct(e,p));let b=["import type { DefineComponent } from '@stacksjs/stx'",`type __DtsxStxComponentType = ${p}`,"const __dtsx_component__: __DtsxStxComponentType = null as unknown as __DtsxStxComponentType","export default __dtsx_component__"];if(e.trim()!=="")b.push(e);return b.join(`
|
|
6
6
|
`)}
|
|
7
|
-
export{O,
|
|
7
|
+
export{O,Ca,I};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a,i}from"./chunk-cgqg1br8.js";import{x}from"./chunk-
|
|
2
|
+
import{a,i}from"./chunk-cgqg1br8.js";import{x}from"./chunk-g743tp4d.js";import{C}from"./chunk-9mdgtq38.js";function Me(f){let r=new Set,n=[];for(let t of f)if(t.kind==="import")for(let o of C(t.text))r.add(o);else if(t.kind!=="unknown"){if(n.push(t.text),t.kind==="variable"){if(t.typeAnnotation)n.push(t.typeAnnotation);else if(t.value)n.push(x(t,!1))}}let e=n.join(`
|
|
3
3
|
`),s=new Set;for(let t=0;t<e.length;){if(!a(e.charCodeAt(t))){t++;continue}let o=t++;while(t<e.length&&i(e.charCodeAt(t)))t++;let c=e.slice(o,t);if(r.has(c))s.add(c)}return{usedItems:s,referenceText:e}}
|
|
4
4
|
export{Me};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{f,be}from"./chunk-587w6ktw.js";import{
|
|
2
|
+
import{f,be}from"./chunk-587w6ktw.js";import{zt,Ut,n,We,U}from"./chunk-ywff3fq9.js";function h(t){if(t.includes(`
|
|
3
3
|
`))return`/**
|
|
4
4
|
* ${t}
|
|
5
5
|
*/
|
|
6
6
|
`;return`/** ${t} */
|
|
7
|
-
`}function D(t){let o=t.indexOf("{");if(o===-1)return-1;let s=t.indexOf("<");if(s===-1||s>o)return o;let e=0,r=!1,a="";for(let i=0;i<t.length;i++){let l=t[i],u=i>0?t[i-1]:"";if(!r&&(l==='"'||l==="'"||l==="`"))r=!0,a=l;else if(r&&l===a&&u!=="\\")r=!1;if(!r){if(l==="<")e++;else if(l===">")e--;else if(l==="{"&&e===0)return i}}return-1}function fe(t,o=!0){return f(t.leadingComments,o)+t.text}function x(t,o=!0){if(t.inferenceError)throw Object.assign(Error(`Cannot infer alias '${t.name}': unsupported source value flow`),{code:t.inferenceError});let s=f(t.leadingComments,o);if(!t.typeAnnotation&&t.inferredType)return s+t.text;if(t.typeAnnotation&&!t.value)return s+t.text;let e="";if(t.isExported)e+="export ";e+="declare ";let r=t.modifiers?.[0]||"const";e+=`${r} `,e+=t.name;let{typeAnnotation:a,value:i}=t,l=!a&&i?U(i):null;if(l)a=l;else if(!a&&i&&i.trim().endsWith("as const"))a=n(i,!0,!1,0,t.computedKeyConstants);else if(!a&&i&&r==="const"){let c=i.trim(),m=c.startsWith("{")||c.startsWith("[");if(m)
|
|
7
|
+
`}function D(t){let o=t.indexOf("{");if(o===-1)return-1;let s=t.indexOf("<");if(s===-1||s>o)return o;let e=0,r=!1,a="";for(let i=0;i<t.length;i++){let l=t[i],u=i>0?t[i-1]:"";if(!r&&(l==='"'||l==="'"||l==="`"))r=!0,a=l;else if(r&&l===a&&u!=="\\")r=!1;if(!r){if(l==="<")e++;else if(l===">")e--;else if(l==="{"&&e===0)return i}}return-1}function fe(t,o=!0){return f(t.leadingComments,o)+t.text}function x(t,o=!0){if(t.inferenceError)throw Object.assign(Error(`Cannot infer alias '${t.name}': unsupported source value flow`),{code:t.inferenceError});let s=f(t.leadingComments,o);if(!t.typeAnnotation&&t.inferredType)return s+t.text;if(t.typeAnnotation&&!t.value)return s+t.text;let e="";if(t.isExported)e+="export ";e+="declare ";let r=t.modifiers?.[0]||"const";e+=`${r} `,e+=t.name;let{typeAnnotation:a,value:i}=t,l=!a&&i?U(i):null;if(l)a=l;else if(!a&&i&&i.trim().endsWith("as const"))a=n(i,!0,!1,0,t.computedKeyConstants);else if(!a&&i&&r==="const"){let c=i.trim(),m=c.startsWith("{")||c.startsWith("[");if(m)zt();a=n(i,!m,!1,0,t.computedKeyConstants)}else if(!a&&i)a=n(i,r==="const",!1,0,t.computedKeyConstants);if(!a)a="unknown";let u="";if(o&&i&&!t.typeAnnotation&&!i.trim().endsWith("as const")){let c=i.trim();if(r!=="const"){if((a==="string"||a==="number"||a==="boolean")&&c.length>0)u=`@defaultValue ${c}`}else if(c.startsWith("{")||c.startsWith("[")){let m=Ut();if(m)if(m.includes(`
|
|
8
8
|
`))u=`@defaultValue
|
|
9
9
|
* \`\`\`ts
|
|
10
10
|
${m.split(`
|
|
11
11
|
`).map((p)=>` * ${p}`).join(`
|
|
12
12
|
`)}
|
|
13
|
-
* \`\`\``;else u=`@defaultValue \`${m}\``}}else if(o&&i&&t.typeAnnotation&&We(t.typeAnnotation)){
|
|
13
|
+
* \`\`\``;else u=`@defaultValue \`${m}\``}}else if(o&&i&&t.typeAnnotation&&We(t.typeAnnotation)){zt();let c=i.trim(),m=c.endsWith("as const")?c.slice(0,-8).trim():c;n(m,!1,!1,0,t.computedKeyConstants);let d=Ut();if(d)if(d.includes(`
|
|
14
14
|
`))u=`@defaultValue
|
|
15
15
|
* \`\`\`ts
|
|
16
16
|
${d.split(`
|
|
@@ -25,5 +25,5 @@ ${d.split(`
|
|
|
25
25
|
* ${c.replace(/^\/\/\s*/,"")}
|
|
26
26
|
* ${u}
|
|
27
27
|
*/
|
|
28
|
-
${e}`}if(u)return`${h(u)}${e}`;return s+e}function de(t,o=!0){let s=f(t.leadingComments,o),e=t.text;if(e.startsWith("export declare interface")||e.startsWith("declare interface"))return s+e;let r="";if(t.isExported)r+="export ";if(r+="declare interface ",r+=t.name,t.generics)r+=t.generics;if(t.extends)r+=` extends ${t.extends}`;let a=D(t.text);if(a!==-1)r+=` ${t.text.slice(a)}`;else r+=" {}";return s+r}function pe(t,o=!0){let s=f(t.leadingComments,o);if(t.text.includes("{")&&t.text.includes("}")&&t.text.includes("from"))return s+t.text;let e="";if(t.isExported)e+="export ";if(!t.isExported&&!t.text.includes(" from "))e+="declare ";let r=t.text.indexOf("type ");if(r!==-1){let i=t.text.slice(r),l=i.length;while(l>0&&(i.charCodeAt(l-1)===59||i.charCodeAt(l-1)===32||i.charCodeAt(l-1)===10||i.charCodeAt(l-1)===13))l--;if(l<i.length)i=i.slice(0,l);e+=i}else{if(e+=`type ${t.name}`,t.generics)e+=t.generics;e+=" = any"}let a=e.trimEnd();if(!a.endsWith(";")&&!a.endsWith("}"))e+=";";return s+e}function me(t,o=!0){return f(t.leadingComments,o)+t.text}function ge(t,o=!0){let s=f(t.leadingComments,o),e="";if(t.isExported)e+="export ";if(e+="declare ",t.modifiers?.includes("const"))e+="const ";e+="enum ",e+=t.name;let r=t.text.indexOf("{");if(r!==-1)e+=` ${t.text.slice(r)}`;else e+=" {}";return s+e}function
|
|
29
|
-
export{fe,x,de,pe,me,ge,
|
|
28
|
+
${e}`}if(u)return`${h(u)}${e}`;return s+e}function de(t,o=!0){let s=f(t.leadingComments,o),e=t.text;if(e.startsWith("export declare interface")||e.startsWith("declare interface"))return s+e;let r="";if(t.isExported)r+="export ";if(r+="declare interface ",r+=t.name,t.generics)r+=t.generics;if(t.extends)r+=` extends ${t.extends}`;let a=D(t.text);if(a!==-1)r+=` ${t.text.slice(a)}`;else r+=" {}";return s+r}function pe(t,o=!0){let s=f(t.leadingComments,o);if(t.text.includes("{")&&t.text.includes("}")&&t.text.includes("from"))return s+t.text;let e="";if(t.isExported)e+="export ";if(!t.isExported&&!t.text.includes(" from "))e+="declare ";let r=t.text.indexOf("type ");if(r!==-1){let i=t.text.slice(r),l=i.length;while(l>0&&(i.charCodeAt(l-1)===59||i.charCodeAt(l-1)===32||i.charCodeAt(l-1)===10||i.charCodeAt(l-1)===13))l--;if(l<i.length)i=i.slice(0,l);e+=i}else{if(e+=`type ${t.name}`,t.generics)e+=t.generics;e+=" = any"}let a=e.trimEnd();if(!a.endsWith(";")&&!a.endsWith("}"))e+=";";return s+e}function me(t,o=!0){return f(t.leadingComments,o)+t.text}function ge(t,o=!0){let s=f(t.leadingComments,o),e="";if(t.isExported)e+="export ";if(e+="declare ",t.modifiers?.includes("const"))e+="const ";e+="enum ",e+=t.name;let r=t.text.indexOf("{");if(r!==-1)e+=` ${t.text.slice(r)}`;else e+=" {}";return s+e}function qn(t){let o=t.text.trim(),s=o.length;while(s>0&&o.charCodeAt(s-1)===59)s--;if(s<o.length)o=o.slice(0,s);return o+=";",o}function Jn(t,o=!0){return f(t.leadingComments,o)+t.text.trim()}function he(t,o=!0){let s=f(t.leadingComments,o);if(t.text.startsWith("declare global"))return s+t.text;if(t.source||(t.name.startsWith('"')||t.name.startsWith("'")||t.name.startsWith("`"))){let i="declare module ";i+=t.name;let l=t.text.indexOf("{");if(l!==-1)i+=` ${t.text.slice(l)}`;else i+=" {}";return s+i}let r="";if(t.isExported)r+="export ";if(!t.modifiers?.includes("declare"))r+="declare ";r+="namespace ",r+=t.name;let a=t.text.indexOf("{");if(a!==-1)r+=` ${t.text.slice(a)}`;else r+=" {}";return s+r}
|
|
29
|
+
export{fe,x,de,pe,me,ge,qn,Jn,he};
|