@dtsx/dtsx 0.11.55 → 0.11.57
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-g25sbqbw.js → chunk-14zb70ca.js} +3 -3
- package/dist/{chunk-tgaear7n.js → chunk-1b003vaa.js} +6 -6
- package/dist/{chunk-2qbj76ap.js → chunk-31t6c3q1.js} +19 -19
- package/dist/{chunk-6b6rt0yh.js → chunk-3phg2e1n.js} +2 -2
- package/dist/{chunk-6c8nk9rm.js → chunk-4rchw3mn.js} +4 -4
- package/dist/{chunk-kg0srf55.js → chunk-4tk9w4ms.js} +1 -1
- package/dist/chunk-59q0p96t.js +3 -0
- package/dist/{chunk-hgg4aqvf.js → chunk-5af6meh8.js} +2 -2
- package/dist/{chunk-9bj73ygx.js → chunk-5egg62em.js} +3 -3
- package/dist/{chunk-h7ebvy8j.js → chunk-5ncggctz.js} +2 -2
- package/dist/{chunk-spdw3tc0.js → chunk-5t69y2qj.js} +2 -2
- package/dist/{chunk-mzxxgnp8.js → chunk-5zcampnz.js} +2 -2
- package/dist/{chunk-8r7rmcz7.js → chunk-6bsft59m.js} +5 -5
- package/dist/chunk-6m4fpfzj.js +31 -0
- package/dist/{chunk-msa98cgm.js → chunk-6mg1pbfj.js} +10 -10
- package/dist/chunk-6rxhkcx0.js +3 -0
- package/dist/{chunk-yxcyqezk.js → chunk-6vhzmpy0.js} +4 -4
- package/dist/{chunk-nnayqrp5.js → chunk-6yvk3q1e.js} +2 -2
- package/dist/{chunk-bt2n0b75.js → chunk-7061vwkq.js} +2 -2
- package/dist/chunk-72txgcxc.js +3 -0
- package/dist/{chunk-heqx5083.js → chunk-8j311f4n.js} +4 -4
- package/dist/{chunk-gwa4hmfa.js → chunk-8z4tvwyd.js} +2 -2
- package/dist/{chunk-hj7gs32r.js → chunk-93jzvstf.js} +2 -2
- package/dist/{chunk-hkcqbex1.js → chunk-9hz32qxh.js} +2 -2
- package/dist/{chunk-c726s7aj.js → chunk-a018gbxq.js} +4 -4
- package/dist/{chunk-pnfjhm01.js → chunk-aa3k6rcj.js} +2 -2
- package/dist/{chunk-njknd1pt.js → chunk-abe0mchv.js} +4 -4
- package/dist/{chunk-hbmnkmzb.js → chunk-b1wmavr8.js} +3 -3
- package/dist/{chunk-btcj8fgc.js → chunk-c094c8jt.js} +3 -3
- package/dist/{chunk-qhkxctek.js → chunk-ctpxwa1v.js} +2 -2
- package/dist/{chunk-x6ddycvm.js → chunk-dc6thsdb.js} +2 -2
- package/dist/{chunk-k8tnz2qd.js → chunk-ered54kd.js} +8 -8
- package/dist/{chunk-38r6thfe.js → chunk-f27fd50q.js} +2 -2
- package/dist/{chunk-eskywkxz.js → chunk-fcx6r0m1.js} +4 -4
- package/dist/{chunk-mph001z4.js → chunk-fnncnk59.js} +4 -4
- package/dist/{chunk-ekf33t9z.js → chunk-fpbcgcwd.js} +3 -3
- package/dist/chunk-fxx9zbtq.js +3 -0
- package/dist/{chunk-555w3kcr.js → chunk-g2s10ehd.js} +2 -2
- package/dist/{chunk-srm0ddsk.js → chunk-gzjccs8y.js} +9 -9
- package/dist/{chunk-cgqg1br8.js → chunk-h3m1vfa2.js} +3 -3
- package/dist/{chunk-b6994asf.js → chunk-hnjv8zsq.js} +2 -2
- package/dist/{chunk-6j6dvj8a.js → chunk-hqytpz18.js} +2 -2
- package/dist/{chunk-vk5r6pgx.js → chunk-jb43rwce.js} +2 -2
- package/dist/chunk-jhjj15ey.js +38 -0
- package/dist/{chunk-fpa2ea8k.js → chunk-k2axmtyh.js} +5 -5
- package/dist/{chunk-kkshxyex.js → chunk-kqyqbrcv.js} +3 -3
- package/dist/{chunk-81jrzxr6.js → chunk-mzpbqdd2.js} +4 -4
- package/dist/{chunk-ewgs91y1.js → chunk-n8044s0h.js} +2 -2
- package/dist/{chunk-4rsk49xj.js → chunk-naweq349.js} +2 -2
- package/dist/{chunk-v22xpr7j.js → chunk-p023fhce.js} +3 -3
- package/dist/{chunk-7dmn623d.js → chunk-ppybvpk4.js} +3 -3
- package/dist/{chunk-1mzxq1rg.js → chunk-q8dtn1qf.js} +2 -2
- package/dist/{chunk-mqv5m22t.js → chunk-qg691xj0.js} +4 -4
- package/dist/{chunk-j7rpp55s.js → chunk-qhbdh4gy.js} +3 -3
- package/dist/{chunk-1t77gtcx.js → chunk-qhsgmwcm.js} +2 -2
- package/dist/{chunk-dak0dhnx.js → chunk-qxkvzznc.js} +2 -2
- package/dist/chunk-r7qq9579.js +7 -0
- package/dist/{chunk-qbk49jz5.js → chunk-rb602c8k.js} +11 -11
- package/dist/{chunk-tw99ftp1.js → chunk-rcmdt2gs.js} +2 -2
- package/dist/{chunk-7pw9ayve.js → chunk-rzjj16rb.js} +3 -3
- package/dist/{chunk-9mdgtq38.js → chunk-s28gyv8z.js} +2 -2
- package/dist/{chunk-qt9gjs57.js → chunk-s3mxfatw.js} +2 -2
- package/dist/{chunk-djbck65n.js → chunk-s5rja20d.js} +2 -2
- package/dist/{chunk-62428w6e.js → chunk-s9937pks.js} +6 -6
- package/dist/{chunk-5bdwrsqt.js → chunk-srbye4cm.js} +4 -4
- package/dist/{chunk-8vvryt8p.js → chunk-ss3na6s0.js} +2 -2
- package/dist/chunk-szxyqpfq.js +3 -0
- package/dist/{chunk-9wwsqemm.js → chunk-try1hmvs.js} +2 -2
- package/dist/{chunk-r46rw8gr.js → chunk-vdt9x6h8.js} +5 -5
- package/dist/chunk-vej5fnnp.js +3 -0
- package/dist/{chunk-f5jc2v3k.js → chunk-vs6ay4t3.js} +2 -2
- package/dist/{chunk-20jq5v1p.js → chunk-w482p1x8.js} +6 -6
- package/dist/{chunk-h6ddkhyq.js → chunk-wmzg12wb.js} +2 -2
- package/dist/{chunk-g9emajpc.js → chunk-xvp60m78.js} +2 -2
- package/dist/chunk-y18th8yp.js +3 -0
- package/dist/{chunk-6r01zgys.js → chunk-yd8rwwzf.js} +2 -2
- package/dist/{chunk-4cr1q0yf.js → chunk-ynpxjf6d.js} +2 -2
- package/dist/{chunk-nmht3krt.js → chunk-ysgfcqvf.js} +4 -4
- package/dist/{chunk-7rdazac9.js → chunk-ywzc3ym6.js} +20 -20
- package/dist/{chunk-rzcnab8j.js → chunk-z03w2v8h.js} +2 -2
- package/dist/{chunk-0d5nemtn.js → chunk-zddtg858.js} +2 -2
- package/dist/{chunk-6ekemc3h.js → chunk-zf6qpv30.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/json-config.js +1 -1
- package/dist/src/lexical.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/numeric-literals.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/syntax-validator.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/tsconfig.js +1 -1
- package/dist/src/type-mappings.js +1 -1
- package/dist/src/utils.js +1 -1
- 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 +1 -1
- package/dist/chunk-0a1xppye.js +0 -3
- package/dist/chunk-5tn8854w.js +0 -31
- package/dist/chunk-5yx2x4v4.js +0 -3
- package/dist/chunk-cfjd81h8.js +0 -3
- package/dist/chunk-daasy0pw.js +0 -3
- package/dist/chunk-h28vzayq.js +0 -3
- package/dist/chunk-sjbm1trn.js +0 -3
- package/dist/chunk-t5nmnzy6.js +0 -7
- package/dist/chunk-vt5hr8vs.js +0 -3
- package/dist/chunk-wq5r1ms9.js +0 -38
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function L(n){return n.endsWith(".vue")}function
|
|
3
|
-
`,i+2);return e===-1?n.length:e+1}if(n[i+1]==="*"){let e=n.indexOf("*/",i+2);return e===-1?n.length:e+2}return i+1}function
|
|
4
|
-
`&&i[t]!=="\r")i[t]=" ";e=s;continue}e++}return i.join("")}function c(n,i,e,s){let t=0,r=i;while(r<n.length){let l=n[r];if(l==='"'||l==="'"){r=h(n,r);continue}if(l==="`"){r=d(n,r);continue}if(l==="/"&&(n[r+1]==="/"||n[r+1]==="*")){r=b(n,r);continue}if(l===e)t++;else if(l===s){if(t--,t===0)return r}r++}return-1}function W(n,i){let e=0,s=i;while(s<n.length){let t=n[s];if(t==='"'||t==="'"){s=h(n,s);continue}if(t==="`"){s=d(n,s);continue}if(t==="/"&&(n[s+1]==="/"||n[s+1]==="*")){s=b(n,s);continue}if(t==="="&&n[s+1]===">"){s+=2;continue}if(t==="<")e++;else if(t===">"){if(e--,e===0)return s}s++}return-1}function S(n,i=","){let e=[],s=0,t="",r=0;while(r<n.length){let l=n[r];if(l==='"'||l==="'"){let u=h(n,r);t+=n.slice(r,u),r=u;continue}if(l==="`"){let u=d(n,r);t+=n.slice(r,u),r=u;continue}if(l==="/"&&(n[r+1]==="/"||n[r+1]==="*")){r=b(n,r);continue}if(l==="{"||l==="["||l==="("||l==="<")s++;else if(l==="}"||l==="]"||l===")"||l===">")s--;if(l===i&&s===0){e.push(t),t="",r++;continue}t+=l,r++}if(t.trim()!=="")e.push(t);return e}function O(n){let i=n.trim();if(!i.startsWith("{"))return[];let e=c(i,0,"{","}");if(e===-1)return[];let s=i.slice(1,e),t=[];for(let r of S(s)){let l=-1,u=0;for(let p=0;p<r.length;p++){let f=r[p];if(f==='"'||f==="'"){p=h(r,p)-1;continue}if(f==="`"){p=d(r,p)-1;continue}if(f==="{"||f==="["||f==="("||f==="<")u++;else if(f==="}"||f==="]"||f===")"||f===">")u--;else if(f===":"&&u===0){l=p;break}}if(l!==-1){t.push({key:E(r.slice(0,l).trim()),value:r.slice(l+1).trim(),isMethod:!1});continue}let o=/^([A-Za-z_$][\w$]*|['"][^'"]+['"])\s*\(/.exec(r.trim());if(o){t.push({key:E(o[1]),value:r.trim(),isMethod:!0});continue}let a=r.trim();if(a)t.push({key:E(a),value:"",isMethod:!1})}return t}function E(n){if(n.startsWith("'")&&n.endsWith("'")||n.startsWith('"')&&n.endsWith('"'))return n.slice(1,-1);return n}function k(n){return/^[A-Za-z_$][\w$]*$/.test(n)?n:JSON.stringify(n)}function
|
|
5
|
-
`)&&u===0)break;l++}return{kind:"type",start:r.index,end:l,bodyStart:o}}return null}var C={String:"string",Number:"number",Boolean:"boolean",Array:"unknown[]",Object:"Record<string, unknown>",Function:"(...args: any[]) => any",Symbol:"symbol",Promise:"Promise<unknown>",Date:"Date",BigInt:"bigint"};function x(n){let i=n.search(/\bas\s+PropType\s*</);if(i===-1)return null;let e=n.indexOf("<",i),s=W(n,e);if(s===-1)return null;if(n.slice(s+1).trim()!=="")return null;return n.slice(e+1,s).trim()}function T(n){let i=n.trim(),e=x(i);if(e!==null)return{type:e,optional:!0};if(i==="null")return{type:"unknown",optional:!0};if(i.startsWith("[")){let s=c(i,0,"[","]");if(s!==-1){let t=S(i.slice(1,s)).map((r)=>T(r).type).filter((r)=>r!=="unknown");return{type:t.length>0?[...new Set(t)].join(" | "):"unknown",optional:!0}}}if(i.startsWith("{")){let s=O(i),t=s.find((o)=>o.key==="type"),r=s.find((o)=>o.key==="required"),l=t?T(t.value).type:"unknown",u=!(r&&r.value.trim()==="true");return{type:l,optional:u}}if(C[i])return{type:C[i],optional:!0};if(/^[A-Za-z_$][\w$.]*$/.test(i))return{type:i,optional:!0};return{type:"unknown",optional:!0}}function
|
|
6
|
-
`)&&e===0){if(s.trim()!=="")i.push(s.trim());s="",t++;continue}s+=r,t++}if(s.trim()!=="")i.push(s.trim());return i}function I(n){let i=n.trim();if(!i.startsWith("{"))return null;let e=c(i,0,"{","}");if(e===-1||i.slice(e+1).trim()!=="")return null;let s=D(i.slice(1,e));if(s.length===0)return"{}";let t=[];for(let r of s){let l=/^\(\s*\w+\s*:\s*/.exec(r);if(!l)return null;let u=l[0].length,o=r[u];if(o!=="'"&&o!=='"'&&o!=="`")return null;let a=h(r,u),p=r.slice(u+1,a-1),f=c(r,r.indexOf("(",0),"(",")");if(f===-1)return null;let m=r.slice(u,f),w=S(m).slice(1),g=r.slice(f+1).trim();if(g.startsWith(":"))g=g.slice(1).trim();if(g==="")g="void";t.push(`${JSON.stringify(p)}: (${w.map((v)=>v.trim()).join(", ")}) => ${g}`)}return`{ ${t.join(", ")} }`}function
|
|
2
|
+
function L(n){return n.endsWith(".vue")}function Po(n){let i={script:null,scriptSetup:null},e=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,s;while((s=e.exec(n))!==null){let t=s[1]||"",r=/lang\s*=\s*["']([^"']+)["']/i.exec(t)?.[1]?.toLowerCase()??"js",l={content:s[2]??"",attrs:t,setup:/\bsetup\b/.test(t),lang:r};if(l.setup)i.scriptSetup=l;else i.script=l}return i}function h(n,i){let e=n[i];i++;while(i<n.length){let s=n[i];if(s==="\\"){i+=2;continue}if(s===e)return i+1;i++}return i}function d(n,i){i++;let e=0;while(i<n.length){let s=n[i];if(s==="\\"){i+=2;continue}if(s==="`"&&e===0)return i+1;if(s==="$"&&n[i+1]==="{"){e++,i+=2;continue}if(s==="}"){if(e>0)e--;i++;continue}i++}return i}function b(n,i){if(n[i+1]==="/"){let e=n.indexOf(`
|
|
3
|
+
`,i+2);return e===-1?n.length:e+1}if(n[i+1]==="*"){let e=n.indexOf("*/",i+2);return e===-1?n.length:e+2}return i+1}function At(n,i){let e=n[i];if(e==='"'||e==="'")return h(n,i);if(e==="`")return d(n,i);if(e==="/"&&(n[i+1]==="/"||n[i+1]==="*"))return b(n,i);return i}function Dt(n){let i=n.split(""),e=0;while(e<n.length){let s=At(n,e);if(s>e){for(let t=e;t<s;t++)if(i[t]!==`
|
|
4
|
+
`&&i[t]!=="\r")i[t]=" ";e=s;continue}e++}return i.join("")}function c(n,i,e,s){let t=0,r=i;while(r<n.length){let l=n[r];if(l==='"'||l==="'"){r=h(n,r);continue}if(l==="`"){r=d(n,r);continue}if(l==="/"&&(n[r+1]==="/"||n[r+1]==="*")){r=b(n,r);continue}if(l===e)t++;else if(l===s){if(t--,t===0)return r}r++}return-1}function W(n,i){let e=0,s=i;while(s<n.length){let t=n[s];if(t==='"'||t==="'"){s=h(n,s);continue}if(t==="`"){s=d(n,s);continue}if(t==="/"&&(n[s+1]==="/"||n[s+1]==="*")){s=b(n,s);continue}if(t==="="&&n[s+1]===">"){s+=2;continue}if(t==="<")e++;else if(t===">"){if(e--,e===0)return s}s++}return-1}function S(n,i=","){let e=[],s=0,t="",r=0;while(r<n.length){let l=n[r];if(l==='"'||l==="'"){let u=h(n,r);t+=n.slice(r,u),r=u;continue}if(l==="`"){let u=d(n,r);t+=n.slice(r,u),r=u;continue}if(l==="/"&&(n[r+1]==="/"||n[r+1]==="*")){r=b(n,r);continue}if(l==="{"||l==="["||l==="("||l==="<")s++;else if(l==="}"||l==="]"||l===")"||l===">")s--;if(l===i&&s===0){e.push(t),t="",r++;continue}t+=l,r++}if(t.trim()!=="")e.push(t);return e}function O(n){let i=n.trim();if(!i.startsWith("{"))return[];let e=c(i,0,"{","}");if(e===-1)return[];let s=i.slice(1,e),t=[];for(let r of S(s)){let l=-1,u=0;for(let p=0;p<r.length;p++){let f=r[p];if(f==='"'||f==="'"){p=h(r,p)-1;continue}if(f==="`"){p=d(r,p)-1;continue}if(f==="{"||f==="["||f==="("||f==="<")u++;else if(f==="}"||f==="]"||f===")"||f===">")u--;else if(f===":"&&u===0){l=p;break}}if(l!==-1){t.push({key:E(r.slice(0,l).trim()),value:r.slice(l+1).trim(),isMethod:!1});continue}let o=/^([A-Za-z_$][\w$]*|['"][^'"]+['"])\s*\(/.exec(r.trim());if(o){t.push({key:E(o[1]),value:r.trim(),isMethod:!0});continue}let a=r.trim();if(a)t.push({key:E(a),value:"",isMethod:!1})}return t}function E(n){if(n.startsWith("'")&&n.endsWith("'")||n.startsWith('"')&&n.endsWith('"'))return n.slice(1,-1);return n}function k(n){return/^[A-Za-z_$][\w$]*$/.test(n)?n:JSON.stringify(n)}function Oe(n,i){let e=new RegExp(`\\b${i}\\b`,"g"),s;while((s=e.exec(n))!==null){let t=s.index+s[0].length;while(t<n.length&&/\s/.test(n[t]))t++;let r=null;if(n[t]==="<"){let o=W(n,t);if(o===-1)return null;r=n.slice(t+1,o).trim(),t=o+1;while(t<n.length&&/\s/.test(n[t]))t++}if(n[t]!=="(")continue;let l=c(n,t,"(",")");if(l===-1)return null;let u=S(n.slice(t+1,l));return{generic:r,arg:u.length>0?u[0].trim():null}}return null}function P(n,i){let e=M(n,i);if(!e)return null;return e.kind==="interface"?n.slice(e.bodyStart,e.end):n.slice(e.bodyStart,e.end).trim()}function M(n,i){let s=new RegExp(`\\binterface\\s+${i}\\b[^{]*\\{`,"m").exec(n);if(s){let l=s.index+s[0].length-1,u=c(n,l,"{","}");if(u!==-1)return{kind:"interface",start:s.index,end:u+1,bodyStart:l}}let r=new RegExp(`\\btype\\s+${i}\\b[^=]*=`,"m").exec(n);if(r){let l=r.index+r[0].length,u=0,o=l;while(l<n.length){let a=n[l];if(a==='"'||a==="'"){l=h(n,l);continue}if(a==="`"){l=d(n,l);continue}if(a==="{"||a==="["||a==="("||a==="<")u++;else if(a==="}"||a==="]"||a===")"||a===">")u--;else if((a===";"||a===`
|
|
5
|
+
`)&&u===0)break;l++}return{kind:"type",start:r.index,end:l,bodyStart:o}}return null}var C={String:"string",Number:"number",Boolean:"boolean",Array:"unknown[]",Object:"Record<string, unknown>",Function:"(...args: any[]) => any",Symbol:"symbol",Promise:"Promise<unknown>",Date:"Date",BigInt:"bigint"};function x(n){let i=n.search(/\bas\s+PropType\s*</);if(i===-1)return null;let e=n.indexOf("<",i),s=W(n,e);if(s===-1)return null;if(n.slice(s+1).trim()!=="")return null;return n.slice(e+1,s).trim()}function T(n){let i=n.trim(),e=x(i);if(e!==null)return{type:e,optional:!0};if(i==="null")return{type:"unknown",optional:!0};if(i.startsWith("[")){let s=c(i,0,"[","]");if(s!==-1){let t=S(i.slice(1,s)).map((r)=>T(r).type).filter((r)=>r!=="unknown");return{type:t.length>0?[...new Set(t)].join(" | "):"unknown",optional:!0}}}if(i.startsWith("{")){let s=O(i),t=s.find((o)=>o.key==="type"),r=s.find((o)=>o.key==="required"),l=t?T(t.value).type:"unknown",u=!(r&&r.value.trim()==="true");return{type:l,optional:u}}if(C[i])return{type:C[i],optional:!0};if(/^[A-Za-z_$][\w$.]*$/.test(i))return{type:i,optional:!0};return{type:"unknown",optional:!0}}function tt(n){let i=n.trim();if(i.startsWith("{")){let e=O(i);if(e.length===0)return"{}";return`{ ${e.map((t)=>{if(t.isMethod||t.value==="")return`${k(t.key)}?: unknown`;let r=T(t.value);return`${k(t.key)}${r.optional?"?":""}: ${r.type}`}).join(", ")} }`}if(i.startsWith("[")){let e=c(i,0,"[","]");if(e===-1)return null;let s=S(i.slice(1,e)).map((t)=>E(t.trim())).filter((t)=>t!=="");if(s.length===0)return"{}";return`{ ${s.map((t)=>`${k(t)}?: unknown`).join(", ")} }`}return null}function V(n){let i=n.trim();if(!i.startsWith("["))return null;let e=c(i,0,"[","]");if(e===-1)return null;let s=S(i.slice(1,e)).map((t)=>t.trim());if(s.length===0)return"{}";if(!s.every((t)=>t.startsWith("'")&&t.endsWith("'")||t.startsWith('"')&&t.endsWith('"')))return"string[]";return`[${s.map((t)=>JSON.stringify(E(t))).join(", ")}]`}function A(n){let i=n.trim();if(!i.startsWith("{"))return null;let e=O(i);if(e.length===0)return"{}";return`{ ${e.map((t)=>`${JSON.stringify(t.key)}: (...args: any[]) => void`).join(", ")} }`}function R(n){return V(n)??A(n)}function D(n){let i=[],e=0,s="",t=0;while(t<n.length){let r=n[t];if(r==='"'||r==="'"){let l=h(n,t);s+=n.slice(t,l),t=l;continue}if(r==="`"){let l=d(n,t);s+=n.slice(t,l),t=l;continue}if(r==="/"&&(n[t+1]==="/"||n[t+1]==="*")){let l=b(n,t);s+=n.slice(t,l),t=l;continue}if(r==="="&&n[t+1]===">"){s+="=>",t+=2;continue}if(r==="{"||r==="["||r==="("||r==="<")e++;else if(r==="}"||r==="]"||r===")"||r===">")e--;if((r===";"||r===","||r===`
|
|
6
|
+
`)&&e===0){if(s.trim()!=="")i.push(s.trim());s="",t++;continue}s+=r,t++}if(s.trim()!=="")i.push(s.trim());return i}function I(n){let i=n.trim();if(!i.startsWith("{"))return null;let e=c(i,0,"{","}");if(e===-1||i.slice(e+1).trim()!=="")return null;let s=D(i.slice(1,e));if(s.length===0)return"{}";let t=[];for(let r of s){let l=/^\(\s*\w+\s*:\s*/.exec(r);if(!l)return null;let u=l[0].length,o=r[u];if(o!=="'"&&o!=='"'&&o!=="`")return null;let a=h(r,u),p=r.slice(u+1,a-1),f=c(r,r.indexOf("(",0),"(",")");if(f===-1)return null;let m=r.slice(u,f),w=S(m).slice(1),g=r.slice(f+1).trim();if(g.startsWith(":"))g=g.slice(1).trim();if(g==="")g="void";t.push(`${JSON.stringify(p)}: (${w.map((v)=>v.trim()).join(", ")}) => ${g}`)}return`{ ${t.join(", ")} }`}function Pt(n){let i=n;for(let e of["defineProps","defineEmits","defineExpose","defineSlots","defineOptions"])i=z(i,e);return i}function z(n,i){let e=new RegExp(`\\b${i}\\b`,"g"),s=[],t=n,r;while((r=e.exec(n))!==null){let l=n.lastIndexOf(`
|
|
7
7
|
`,r.index)+1,u=n.slice(l,r.index),o=/^\s*(?:(?:const|let|var)\s+[A-Za-z_$][\w$]*\s*(?::[^=]+)?=\s*)?(withDefaults\s*\(\s*)?$/.exec(u);if(!o)continue;let a=r.index+r[0].length;while(a<n.length&&/\s/.test(n[a]))a++;if(n[a]==="<"){let m=W(n,a);if(m===-1)continue;a=m+1;while(a<n.length&&/\s/.test(n[a]))a++}if(n[a]!=="(")continue;let p=c(n,a,"(",")");if(p===-1)continue;if(o[1]){let m=l+u.length-o[1].length,w=n.indexOf("(",m);if(w!==-1){let g=c(n,w,"(",")");if(g!==-1)p=g}}let f=p+1;while(f<n.length&&n[f]!==`
|
|
8
8
|
`&&/\s|;/.test(n[f]))f++;if(n[f]===`
|
|
9
|
-
`)f++;s.push([l,f])}for(let l=s.length-1;l>=0;l--)t=t.slice(0,s[l][0])+t.slice(s[l][1]);return t}function
|
|
9
|
+
`)f++;s.push([l,f])}for(let l=s.length-1;l>=0;l--)t=t.slice(0,s[l][0])+t.slice(s[l][1]);return t}function Rt(n){let i=Z(n);if(i!==-1){let e=/^export\s+default\b/.exec(n.slice(i))?.[0];if(!e)return{options:null,script:n,passthrough:!1};let s=i+e.length;while(s<n.length&&/\s/.test(n[s]))s++;let t=-1,r=-1,l=-1;if(n[s]==="{")t=s,r=c(n,s,"{","}"),l=r;else if(n.startsWith("defineComponent",s)){let a=n.indexOf("(",s);if(a!==-1){let p=a+1;while(p<n.length&&/\s/.test(n[p]))p++;if(n[p]==="{")t=p,r=c(n,p,"{","}"),l=c(n,a,"(",")")}}if(t===-1||r===-1||l===-1)return{options:null,script:n,passthrough:!0};let u=l+1;if(n[u]===";")u++;let o=(n.slice(0,i)+n.slice(u)).trim();return{options:n.slice(t,r+1),script:o,passthrough:!1}}return{options:null,script:n,passthrough:!1}}function Z(n){let i=0,e=0;while(e<n.length){let s=n[e];if(s==='"'||s==="'"){e=h(n,e);continue}if(s==="`"){e=d(n,e);continue}if(s==="/"&&(n[e+1]==="/"||n[e+1]==="*")){e=b(n,e);continue}if(s==="{"||s==="["||s==="(")i++;else if(s==="}"||s==="]"||s===")")i=Math.max(0,i-1);else if(i===0&&n.startsWith("export",e)){let t=e===0?"":n[e-1],r=n[e+6]??"";if(!/[\w$]/.test(t)&&!/[\w$]/.test(r)){if(/^export\s+default\b/.exec(n.slice(e)))return e}}e++}return-1}function nt(n,i){let e=O(n).find((s)=>s.key===i);return e&&e.value!==""?e.value:null}function rt(n,i){let e=q(n),s=n;for(let t=e.length-1;t>=0;t--){let r=e[t],l=s.slice(0,r.start)+s.slice(r.end);if(B(l,r.name))continue;if(new RegExp(`\\btypeof\\s+${r.name}\\b`).test(i))continue;s=l}return s}function B(n,i){let e=0;while(e<n.length){let s=n[e];if(s==='"'||s==="'"){e=h(n,e);continue}if(s==="`"){e=d(n,e);continue}if(s==="/"&&(n[e+1]==="/"||n[e+1]==="*")){e=b(n,e);continue}if(/[A-Za-z_$]/.test(s)){let t=e+1;while(t<n.length&&/[\w$]/.test(n[t]))t++;if(n.slice(e,t)===i)return!0;e=t;continue}e++}return!1}function q(n){let i=[],e=J(n),s=/^[ \t]*(const|let|var|(?:async[ \t]+)?function)[ \t]+([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=?/gm,t;while((t=s.exec(n))!==null){let r=n.lastIndexOf(`
|
|
10
10
|
`,t.index)+1;if(!e.has(r))continue;if(/\bexport\b/.test(n.slice(r,t.index)))continue;let l=t[1],u=t[2],o=t.index+t[0].length,a=-1;if(l.endsWith("function")){let p=n.indexOf("(",o);if(p===-1)continue;let f=c(n,p,"(",")");if(f===-1)continue;o=f+1;while(o<n.length&&/\s/.test(n[o]))o++;if(n[o]===":")while(o<n.length&&n[o]!=="{"&&n[o]!==`
|
|
11
11
|
`)o++;while(o<n.length&&/\s/.test(n[o])&&n[o]!==`
|
|
12
12
|
`)o++;if(n[o]!=="{")continue;let m=c(n,o,"{","}");if(m===-1)continue;a=m+1}else{let p=0;while(o<n.length){let f=n[o];if(f==='"'||f==="'"){o=h(n,o);continue}if(f==="`"){o=d(n,o);continue}if(f==="/"&&(n[o+1]==="/"||n[o+1]==="*")){o=b(n,o);continue}if(f==="{"||f==="["||f==="(")p++;else if(f==="}"||f==="]"||f===")")p--;else if(f===";"&&p===0){a=o+1;break}else if(f===`
|
|
13
13
|
`&&p===0){a=o;break}o++}if(a===-1)a=n.length}if(n[a]===`
|
|
14
14
|
`)a++;i.push({name:u,start:t.index,end:a})}return i}function J(n){let i=new Set([0]),e=0,s=0;while(s<n.length){let t=n[s];if(t==='"'||t==="'"){s=h(n,s);continue}if(t==="`"){s=d(n,s);continue}if(t==="/"&&(n[s+1]==="/"||n[s+1]==="*")){s=b(n,s);continue}if(t==="{"||t==="["||t==="(")e++;else if(t==="}"||t==="]"||t===")")e=Math.max(0,e-1);if(t===`
|
|
15
|
-
`&&e===0)i.add(s+1);s++}return i}function
|
|
16
|
-
`,s)+1;if(/\bexport\b/.test(n.slice(t,s)))return n;let r=n.slice(0,s)+n.slice(s+e.length);if(new RegExp(`\\b${i}\\b`).test(r))return n;return r}function
|
|
15
|
+
`&&e===0)i.add(s+1);s++}return i}function it(n,i,e){let s=n.indexOf(e);if(s===-1)return n;let t=n.lastIndexOf(`
|
|
16
|
+
`,s)+1;if(/\bexport\b/.test(n.slice(t,s)))return n;let r=n.slice(0,s)+n.slice(s+e.length);if(new RegExp(`\\b${i}\\b`).test(r))return n;return r}function Mt(n){let i="",e=0,s=()=>{for(let r=i.length-1;r>=0;r--)if(!/\s/.test(i[r]))return i[r];return""},t=(r)=>{for(let l=r;l<n.length;l++)if(!/\s/.test(n[l]))return n[l];return""};while(e<n.length){let r=n[e];if(r==='"'||r==="'"){let l=h(n,e);i+=n.slice(e,l),e=l;continue}if(r==="`"){let l=d(n,e);i+=n.slice(e,l),e=l;continue}if(r==="/"&&n[e+1]==="*"){let l=b(n,e);i+=n.slice(e,l).replace(/\s*\n\s*/g," "),e=l;continue}if(r==="/"&&n[e+1]==="/"){let l=e+2;while(l<n.length&&n[l]!==`
|
|
17
17
|
`)l++;let u=n.slice(e+2,l).trim();if(u!==""&&!u.includes("*/"))i+=`/* ${u} */`;e=l;continue}if(r===`
|
|
18
|
-
`){let l=s(),u=t(e+1);if(l===""||u===""){e++;continue}let o=F(i);if(!o&&("{;,(<:=[".includes(l)||"}),]>;|&".includes(u))){if(!i.endsWith(" ")&&!i.endsWith(";"))i+=" "}else if(o){if(!i.endsWith(" "))i+=" "}else{if(i.endsWith(" "))i=i.slice(0,-1);i+="; "}e++;while(e<n.length&&(n[e]===" "||n[e]==="\t"))e++;continue}i+=r,e++}return i}function F(n){let i=n.length-1;while(i>=0&&/\s/.test(n[i]))i--;if(i<1||n[i]!=="/"||n[i-1]!=="*")return!1;let e=n.lastIndexOf("/*",i);if(e===-1)return!1;for(let s=e-1;s>=0;s--){let t=n[s];if(/\s/.test(t))continue;return"{;,(<:".includes(t)}return!0}function
|
|
19
|
-
${i.scriptSetup.content}`:i.script.content;if(e=y.script,y.options){let _=
|
|
18
|
+
`){let l=s(),u=t(e+1);if(l===""||u===""){e++;continue}let o=F(i);if(!o&&("{;,(<:=[".includes(l)||"}),]>;|&".includes(u))){if(!i.endsWith(" ")&&!i.endsWith(";"))i+=" "}else if(o){if(!i.endsWith(" "))i+=" "}else{if(i.endsWith(" "))i=i.slice(0,-1);i+="; "}e++;while(e<n.length&&(n[e]===" "||n[e]==="\t"))e++;continue}i+=r,e++}return i}function F(n){let i=n.length-1;while(i>=0&&/\s/.test(n[i]))i--;if(i<1||n[i]!=="/"||n[i-1]!=="*")return!1;let e=n.lastIndexOf("/*",i);if(e===-1)return!1;for(let s=e-1;s>=0;s--){let t=n[s];if(/\s/.test(t))continue;return"{;,(<:".includes(t)}return!0}function st(n,i){let e=[n,i].filter((s)=>s!==null);for(let s of e){let t=Oe(s,"defineProps");if(!t)continue;if(t.generic){let r=t.generic;if(r.startsWith("{"))return{type:r};if(/^[A-Za-z_$][\w$]*$/.test(r)){for(let l of e){let u=M(l,r);if(!u)continue;let o=P(l,r);if(o===null)continue;return{type:o,inlinedLocal:{name:r,declText:l.slice(u.start,u.end)}}}return{type:r}}return{type:r}}if(t.arg){let r=tt(t.arg);if(r!==null)return{type:r}}}return null}function Ot(n,i){let e=[n,i].filter((s)=>s!==null);for(let s of e){let t=Oe(s,"defineEmits");if(!t)continue;if(t.generic)return I(t.generic)??t.generic;if(t.arg){let r=R(t.arg);if(r!==null)return r}}return null}function It(n,i){let e=[n,i].filter((s)=>s!==null);for(let s of e){let t=Oe(s,"defineExpose");if(!t||!t.arg||!t.arg.startsWith("{"))continue;let r=O(t.arg);if(r.length===0)return null;return`{ ${r.map((u)=>{if(u.value===""&&/^[A-Za-z_$][\w$]*$/.test(u.key))return`${k(u.key)}: typeof ${u.key}`;let o=u.isMethod||/=>|^\s*function\b/.test(u.value);return`${k(u.key)}: ${o?"(...args: any[]) => any":"unknown"}`}).join(", ")} }`}return null}function N(n){let i=Po(n),e="",s=null,t=null;if(i.script){let y=Rt(i.script.content);if(y.passthrough)return i.scriptSetup?`${i.script.content}
|
|
19
|
+
${i.scriptSetup.content}`:i.script.content;if(e=y.script,y.options){let _=nt(y.options,"props");if(_)s=tt(_);let j=nt(y.options,"emits");if(j)t=R(j)}}let r=i.scriptSetup?.content??null,l=r!==null?Pt(r):null,u=st(r,r!==null?null:e),o=u?.type??s??"{}",a=Ot(r,null)??t,p=It(r,null),f=u?.inlinedLocal;if(f){if(e=it(e,f.name,f.declText),l!==null)l=it(l,f.name,f.declText)}let m=[o,p??"{}"];if(a)m.push("{}","{}","{}","{}","{}",a);let w=Mt(`DefineComponent<${m.join(", ")}>`),g=[],v=rt(e,w);if(v.trim()!=="")g.push(v);if(l&&l.trim()!==""){let y=rt(l,w);if(y.trim()!=="")g.push(y)}return g.push("import type { DefineComponent } from 'vue'"),g.push(`type __DtsxComponentType = ${w}`),g.push("const __dtsx_component__: __DtsxComponentType = null as unknown as __DtsxComponentType"),g.push("export default __dtsx_component__"),g.join(`
|
|
20
20
|
`)}
|
|
21
|
-
export{L,
|
|
21
|
+
export{L,Po,At,Dt,c,Oe,tt,Pt,Rt,nt,rt,it,Mt,st,Ot,It,N};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{V}from"./chunk-mew3f4wh.js";import{p}from"./chunk-v6fwy63g.js";var f=100,c=new Map,a=new Map,u=new Map,g=0;function d(e,n,t){let r={fileName:e,text:n};c.delete(e),c.set(e,{file:r,hash:t});while(c.size>f){let s=c.keys().next().value;if(s===void 0)break;c.delete(s)}return r}function b(e,n,t){return u.set(e,(u.get(e)??0)+1),d(e,n,t)}function
|
|
3
|
-
export{
|
|
2
|
+
import{V}from"./chunk-mew3f4wh.js";import{p}from"./chunk-v6fwy63g.js";var f=100,c=new Map,a=new Map,u=new Map,g=0;function d(e,n,t){let r={fileName:e,text:n};c.delete(e),c.set(e,{file:r,hash:t});while(c.size>f){let s=c.keys().next().value;if(s===void 0)break;c.delete(s)}return r}function b(e,n,t){return u.set(e,(u.get(e)??0)+1),d(e,n,t)}function Lt(e,n,t=p(n)){let r=c.get(e);if(r?.hash===t)return c.delete(e),c.set(e,r),r.file;return b(e,n,t)}async function ae(e,n,t={}){let r=p(n);if(c.get(e)?.hash===r)return Lt(e,n,r);let o=`${e}\x00${String(r)}`,i=a.get(o);if(i)return i;let h=(u.get(e)??0)+1;u.set(e,h);let m=g,l;return l=Promise.resolve().then(async()=>{try{if(n.length>=(t.asyncThreshold??1e5))await new Promise((y)=>setTimeout(y,Math.max(0,t.yieldInterval??0)));if(m===g&&u.get(e)===h)return d(e,n,r);return{fileName:e,text:n}}finally{if(a.get(o)===l)a.delete(o)}}),a.set(o,l),l}async function Sn(e,n={}){let t=new Map,r=V(n.concurrency,4);for(let s=0;s<e.length;s+=r){let o=await Promise.all(e.slice(s,s+r).map(async(i)=>({path:i.filePath,file:await ae(i.filePath,i.sourceCode,n)})));for(let i of o)t.set(i.path,i.file)}return t}function $n(){g++,c.clear(),a.clear(),u.clear()}function En(){return c.size}function kn(){return a.size}function Tn(e,n={}){return e.length>=(n.asyncThreshold??1e5)}
|
|
3
|
+
export{Lt,ae,Sn,$n,En,kn,Tn};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
class
|
|
2
|
+
class ke{plugins=[];config=null;register(t){if(this.plugins.some((n)=>n.name===t.name))throw Error(`Plugin "${t.name}" is already registered`);this.plugins.push(t)}hasDeclarationHooks(){return this.plugins.some((t)=>t.onDeclarations!==void 0)}unregister(t){let n=this.plugins.findIndex((r)=>r.name===t);if(n>=0)return this.plugins.splice(n,1),!0;return!1}getPlugins(){return this.plugins}createLogger(t){return{debug:(n)=>console.debug(`[${t}] ${n}`),info:(n)=>console.info(`[${t}] ${n}`),warn:(n)=>console.warn(`[${t}] ${n}`),error:(n)=>console.error(`[${t}] ${n}`)}}async runOnStart(t){let n=t;for(let r of this.plugins)if(r.onStart){let e=await r.onStart(n);if(e)n=e}return this.config=n,n}async runOnBeforeFile(t,n){let r=n;for(let e of this.plugins)if(e.onBeforeFile){let i={filePath:t,sourceCode:n,content:r,config:this.config,log:this.createLogger(e.name)},o=await e.onBeforeFile(i);if(typeof o==="string")r=o}return r}async runOnDeclarations(t,n,r){let e=r;for(let i of this.plugins)if(i.onDeclarations){let o={filePath:t,sourceCode:n,declarations:e,config:this.config,log:this.createLogger(i.name)},s=await i.onDeclarations(o);if(s)e=s}return e}async runOnAfterFile(t,n,r){let e=r;for(let i of this.plugins)if(i.onAfterFile){let o={filePath:t,sourceCode:n,content:e,config:this.config,log:this.createLogger(i.name)},s=await i.onAfterFile(o);if(typeof s==="string")e=s}return e}async runOnEnd(t){for(let n of this.plugins)if(n.onEnd)await n.onEnd(t)}async runOnError(t,n,r){for(let e of this.plugins)if(e.onError){let i={filePath:n,sourceCode:r,config:this.config,log:this.createLogger(e.name)};await e.onError(t,i)}}}var Zs=new ke;function se(t){return t}var Qs=se({name:"strip-internal",version:"1.0.0",description:"Removes declarations marked with @internal",onDeclarations:(t)=>t.declarations.filter((n)=>{if(n.leadingComments){if(n.leadingComments.some((e)=>e.includes("@internal")))return t.log.debug(`Stripping internal declaration: ${n.name}`),!1}return!0})});function eo(t){return se({name:"banner",version:"1.0.0",description:"Adds a banner comment to generated files",onAfterFile:(n)=>`/**
|
|
3
3
|
* ${t.split(`
|
|
4
4
|
`).join(`
|
|
5
5
|
* `)}
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
`+n.content})}function
|
|
9
|
-
export{
|
|
8
|
+
`+n.content})}function to(t){return se({name:"filter",version:"1.0.0",description:"Filters declarations by name",onDeclarations:(n)=>n.declarations.filter((r)=>{if(r.kind==="import")return!0;return t(r.name)})})}
|
|
9
|
+
export{ke,Zs,se,Qs,eo,to};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,
|
|
3
|
-
export{
|
|
2
|
+
import{t,k,ze,b}from"./chunk-r7qq9579.js";import{Xn,Zn}from"./chunk-zf6qpv30.js";function E(n){return b(n).find((e)=>e.category==="static-import")}function D(n){return t(n).map((e)=>n.slice(e.start,e.end)).join(" ")}function S(n){let e=E(n);return e?n.lastIndexOf(" from ",e.start):-1}function Be(n){let e=E(n);return e?k(e.specifier,"'"):void 0}function Yn(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=Xn(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 Zn(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=D(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=S(n);if(r===-1)return null;let u=E(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),T=W(I);for(let h of T){let q=Ni(h),y=q?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||q,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=Ni(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 Ni(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=Be(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{Be,Yn,C,v,_a,Ni,ja,Ga};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{s}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{s}from"./chunk-6m4fpfzj.js";function ve(a={}){let{onStart:d=!1,onEnd:l=!0,onGenerated:u,onError:i,...n}=a,e=async()=>{try{let r=await s(n);u?.(r)}catch(r){let t=r instanceof Error?r:Error(String(r));if(i?.(t),!i)console.error("[dtsx] Generation failed:",t.message)}};return{name:"dtsx",setup(r){let t=r.initialOptions;if(!n.entrypoints&&t.entryPoints)if(Array.isArray(t.entryPoints))n.entrypoints=t.entryPoints;else n.entrypoints=Object.values(t.entryPoints);if(!n.outdir){if(t.outdir)n.outdir=t.outdir;else if(t.outfile){let o=t.outfile.lastIndexOf("/");if(o!==-1)n.outdir=t.outfile.substring(0,o)}}if(d)r.onStart(async()=>{await e()});if(l)r.onEnd(async(o)=>{if(o.errors.length===0)await e()})}}}var Ra=ve,dr=ve,Ma=ve;
|
|
3
|
+
export{ve,Ra,dr,Ma};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{G}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{G}from"./chunk-31t6c3q1.js";import{R}from"./chunk-qhsgmwcm.js";import{Ae,De}from"./chunk-6vhzmpy0.js";import{createHash as x}from"crypto";import{readFile as d}from"fs/promises";import{resolve as m}from"path";async function xn(g){let e={...G,...g},n=e.moduleSpecifierMode??"preserve";if(n!=="node"&&n!=="preserve")throw Error("moduleSpecifierMode must be preserve or node");if(e.plugins?.length)throw Error("Native project planning does not support generation plugins");let o=await Ae(e),l=[];for(let r of o.files){let s=await d(r),a=s.toString("utf8");if(!Buffer.from(a,"utf8").equals(s))throw Error(`Native declaration source must be valid UTF-8: ${r}`);let u=o.outputBySource.get(r),v=De(r,e,o.resolver),i=[],S=new Set(R(a,{includeImports:!0}).map((t)=>t.specifier));for(let t of S){let p=v(t);if(p.kind!=="local")continue;let{resolvedSource:h,declarationOutput:w,emittedSpecifier:y}=p;i.push({specifier:t,resolvedSource:h,declarationOutput:w,emittedSpecifier:y})}let c={version:1,moduleSpecifierMode:n,sourceFile:r,outputFile:u,sourceHash:x("sha256").update(s).digest("hex"),rewrites:i};if(!e.isolatedDeclarations&&i.length)c.inferenceSources=await Promise.all(i.map(async(t)=>({specifier:t.specifier,source:await d(t.resolvedSource,"utf8")})));let f=o.augmentationImports.get(r);if(f?.size)c.augmentationImports=[...f];l.push(Object.freeze({sourceFile:r,outputFile:u,source:a,context:c}))}return Object.freeze({version:1,rootPath:m(e.cwd,e.root),outdirPath:m(e.cwd,e.outdir),files:Object.freeze(l)})}
|
|
3
|
+
export{xn};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{r}from"./chunk-
|
|
2
|
+
import{r}from"./chunk-59q0p96t.js";import{e}from"./chunk-ss3na6s0.js";import{existsSync as j,mkdirSync as S,readFileSync as E,writeFileSync as f}from"fs";import{basename as h,join as g}from"path";function Yt(t){let n={description:"",params:[],examples:[],tags:{},see:[],throws:[]};if(!t||t.length===0)return n;for(let s of t){let o=s.replace(/^\/\*\*/,"").replace(/\*\/$/,"").split(`
|
|
3
3
|
`).map((p)=>p.replace(/^\s*\*\s?/,"")).join(`
|
|
4
|
-
`).trim(),i=o.search(/@\w+/);if(i===-1){n.description=o;continue}else if(i>0)n.description=o.slice(0,i).trim(),o=o.slice(i);let a=/@(\w+)(?:\s+\{([^}]+)\})?\s*([^\n@]*(?:\n(?!@)[^\n@]*)*)/g,c;while((c=a.exec(o))!==null){let[,p,u,d]=c,m=d.trim();switch(p){case"param":{let l=m.match(/^(\[)?(\w+)\]?\s*(?:-\s*)?(.*)/);if(l)n.params.push({name:l[2],type:u,description:l[3].trim(),optional:!!l[1]});break}case"returns":case"return":n.returns={type:u,description:m};break;case"example":n.examples.push(m);break;case"deprecated":n.deprecated=m||"Deprecated";break;case"since":n.since=m;break;case"see":n.see.push(m);break;case"throws":case"throw":n.throws.push({type:u,description:m});break;case"category":n.category=m;break;default:if(!n.tags[p])n.tags[p]=[];n.tags[p].push(m)}}}return n}function w(t,n){let s=
|
|
5
|
-
`)}function k(t,n){let s=[];if(s.push(`### ${t.name}`),s.push(""),t.jsdoc.deprecated)s.push(`> **Deprecated:** ${t.jsdoc.deprecated}`),s.push("");if(s.push("```typescript"),s.push(t.signature),s.push("```"),s.push(""),t.jsdoc.description)s.push(t.jsdoc.description),s.push("");if(t.jsdoc.params.length>0){s.push("**Parameters:**"),s.push(""),s.push("| Name | Type | Description |"),s.push("|------|------|-------------|");for(let o of t.jsdoc.params){let i=o.optional?" (optional)":"",a=o.type||"any";s.push(`| \`${o.name}\`${i} | \`${a}\` | ${o.description} |`)}s.push("")}if(t.jsdoc.returns){s.push("**Returns:**"),s.push("");let o=t.jsdoc.returns.type?`\`${t.jsdoc.returns.type}\``:"";s.push(`${o} ${t.jsdoc.returns.description}`),s.push("")}if(t.jsdoc.throws.length>0){s.push("**Throws:**"),s.push("");for(let o of t.jsdoc.throws){let i=o.type?`\`${o.type}\``:"";s.push(`- ${i} ${o.description}`)}s.push("")}if(t.jsdoc.examples.length>0){s.push("**Examples:**"),s.push("");for(let o of t.jsdoc.examples)s.push("```typescript"),s.push(o),s.push("```"),s.push("")}if(t.jsdoc.see.length>0){s.push("**See also:**"),s.push("");for(let o of t.jsdoc.see)s.push(`- ${o}`);s.push("")}if(t.jsdoc.since)s.push(`*Since: ${t.jsdoc.since}*`),s.push("");if(n.includeSourceLinks&&t.sourceFile){let o=t.sourceFile;if(n.sourceBaseUrl)s.push(`[Source](${n.sourceBaseUrl}/${o})`);else s.push(`*Source: ${o}*`);s.push("")}if(t.members&&t.members.length>0){s.push("**Members:**"),s.push("");for(let o of t.members)if(s.push(`#### ${o.name}`),s.push(""),s.push("```typescript"),s.push(o.signature),s.push("```"),s.push(""),o.jsdoc.description)s.push(o.jsdoc.description),s.push("")}return s.push("---"),s.push(""),s}function
|
|
4
|
+
`).trim(),i=o.search(/@\w+/);if(i===-1){n.description=o;continue}else if(i>0)n.description=o.slice(0,i).trim(),o=o.slice(i);let a=/@(\w+)(?:\s+\{([^}]+)\})?\s*([^\n@]*(?:\n(?!@)[^\n@]*)*)/g,c;while((c=a.exec(o))!==null){let[,p,u,d]=c,m=d.trim();switch(p){case"param":{let l=m.match(/^(\[)?(\w+)\]?\s*(?:-\s*)?(.*)/);if(l)n.params.push({name:l[2],type:u,description:l[3].trim(),optional:!!l[1]});break}case"returns":case"return":n.returns={type:u,description:m};break;case"example":n.examples.push(m);break;case"deprecated":n.deprecated=m||"Deprecated";break;case"since":n.since=m;break;case"see":n.see.push(m);break;case"throws":case"throw":n.throws.push({type:u,description:m});break;case"category":n.category=m;break;default:if(!n.tags[p])n.tags[p]=[];n.tags[p].push(m)}}}return n}function w(t,n){let s=Yt(t.leadingComments),o="";switch(t.kind){case"function":o=M(t);break;case"variable":o=C(t);break;case"interface":o=P(t);break;case"type":o=v(t);break;case"class":o=T(t);break;case"enum":o=F(t);break;default:o=t.text||t.name}let i={name:t.name,kind:t.kind,signature:o,jsdoc:s,isExported:t.isExported,isDefault:t.isDefault,sourceFile:n};if(t.members&&t.members.length>0)i.members=t.members.map((a)=>w(a,n));return i}function M(t){let n=[];if(t.isExported)n.push("export");if(t.isDefault)n.push("default");if(n.push("function"),n.push(t.name),t.generics)n.push(t.generics);if(t.parameters){let s=t.parameters.map((o)=>{let i="";if(o.rest)i+="...";if(i+=o.name,o.optional)i+="?";if(o.type)i+=`: ${o.type}`;return i}).join(", ");n.push(`(${s})`)}else n.push("()");if(t.returnType)n.push(`: ${t.returnType}`);return n.join(" ").replace(/\s+/g," ")}function C(t){let n=[];if(t.isExported)n.push("export");if(n.push("const"),n.push(t.name),t.typeAnnotation)n.push(`: ${t.typeAnnotation}`);return n.join(" ")}function P(t){let n=[];if(t.isExported)n.push("export");if(n.push("interface"),n.push(t.name),t.generics)n.push(t.generics);if(t.extends)n.push(`extends ${t.extends}`);return n.join(" ")}function v(t){let n=[];if(t.isExported)n.push("export");if(n.push("type"),n.push(t.name),t.generics)n.push(t.generics);if(n.push("="),t.typeAnnotation)n.push(t.typeAnnotation);return n.join(" ")}function T(t){let n=[];if(t.isExported)n.push("export");if(t.isDefault)n.push("default");if(n.push("class"),n.push(t.name),t.generics)n.push(t.generics);if(t.extends)n.push(`extends ${t.extends}`);if(t.implements&&t.implements.length>0)n.push(`implements ${t.implements.join(", ")}`);return n.join(" ")}function F(t){let n=[];if(t.isExported)n.push("export");return n.push("enum"),n.push(t.name),n.join(" ")}async function Xt(t,n={}){let s=[],o=new Map;for(let i of t){if(!j(i)){e.warn(`File not found: ${i}`);continue}let a=E(i,"utf-8"),c=r(a,i,!0);for(let p of c){if(p.kind==="import")continue;if(!n.includePrivate&&p.name.startsWith("_"))continue;if(!n.includeInternal&&p.leadingComments?.some((d)=>d.includes("@internal")))continue;let u=w(p,i);if(s.push(u),n.groupByCategory&&u.jsdoc.category){let d=u.jsdoc.category;if(!o.has(d))o.set(d,[]);o.get(d).push(u)}}}return{title:n.title||"API Documentation",description:n.description,entries:s,categories:o,generatedAt:new Date}}function Je(t,n={}){let s=[];if(s.push(`# ${t.title}`),s.push(""),t.description)s.push(t.description),s.push("");if(s.push(`> Generated on ${t.generatedAt.toISOString()}`),s.push(""),s.push("## Table of Contents"),s.push(""),n.groupByCategory&&t.categories.size>0)for(let o of t.categories.keys())s.push(`- [${o}](#${D(o)})`);else{let o=x(t.entries);for(let[i,a]of o)if(a.length>0)s.push(`- [${b(i)}](#${D(b(i))})`)}if(s.push(""),n.groupByCategory&&t.categories.size>0)for(let[o,i]of t.categories){s.push(`## ${o}`),s.push("");for(let a of i)s.push(...k(a,n))}else{let o=x(t.entries);for(let[i,a]of o)if(a.length>0){s.push(`## ${b(i)}`),s.push("");for(let c of a)s.push(...k(c,n))}}return s.join(`
|
|
5
|
+
`)}function k(t,n){let s=[];if(s.push(`### ${t.name}`),s.push(""),t.jsdoc.deprecated)s.push(`> **Deprecated:** ${t.jsdoc.deprecated}`),s.push("");if(s.push("```typescript"),s.push(t.signature),s.push("```"),s.push(""),t.jsdoc.description)s.push(t.jsdoc.description),s.push("");if(t.jsdoc.params.length>0){s.push("**Parameters:**"),s.push(""),s.push("| Name | Type | Description |"),s.push("|------|------|-------------|");for(let o of t.jsdoc.params){let i=o.optional?" (optional)":"",a=o.type||"any";s.push(`| \`${o.name}\`${i} | \`${a}\` | ${o.description} |`)}s.push("")}if(t.jsdoc.returns){s.push("**Returns:**"),s.push("");let o=t.jsdoc.returns.type?`\`${t.jsdoc.returns.type}\``:"";s.push(`${o} ${t.jsdoc.returns.description}`),s.push("")}if(t.jsdoc.throws.length>0){s.push("**Throws:**"),s.push("");for(let o of t.jsdoc.throws){let i=o.type?`\`${o.type}\``:"";s.push(`- ${i} ${o.description}`)}s.push("")}if(t.jsdoc.examples.length>0){s.push("**Examples:**"),s.push("");for(let o of t.jsdoc.examples)s.push("```typescript"),s.push(o),s.push("```"),s.push("")}if(t.jsdoc.see.length>0){s.push("**See also:**"),s.push("");for(let o of t.jsdoc.see)s.push(`- ${o}`);s.push("")}if(t.jsdoc.since)s.push(`*Since: ${t.jsdoc.since}*`),s.push("");if(n.includeSourceLinks&&t.sourceFile){let o=t.sourceFile;if(n.sourceBaseUrl)s.push(`[Source](${n.sourceBaseUrl}/${o})`);else s.push(`*Source: ${o}*`);s.push("")}if(t.members&&t.members.length>0){s.push("**Members:**"),s.push("");for(let o of t.members)if(s.push(`#### ${o.name}`),s.push(""),s.push("```typescript"),s.push(o.signature),s.push("```"),s.push(""),o.jsdoc.description)s.push(o.jsdoc.description),s.push("")}return s.push("---"),s.push(""),s}function Zt(t,n={}){let s=Je(t,n);return`<!DOCTYPE html>
|
|
6
6
|
<html lang="en">
|
|
7
7
|
<head>
|
|
8
8
|
<meta charset="UTF-8">
|
|
@@ -97,6 +97,6 @@ import{r}from"./chunk-0a1xppye.js";import{e}from"./chunk-8vvryt8p.js";import{exi
|
|
|
97
97
|
document.getElementById('content').innerHTML = marked.parse(markdown);
|
|
98
98
|
</script>
|
|
99
99
|
</body>
|
|
100
|
-
</html>`}function
|
|
101
|
-
`)),e.info(`Generated: ${g(n.outdir,"README.md")}`)}else{let o=Je(s,n),i=g(n.outdir,"API.md");f(i,o),e.info(`Generated: ${i}`)}else if(n.format==="json"){let o=
|
|
102
|
-
export{
|
|
100
|
+
</html>`}function Qt(t,n={}){let s={title:t.title,description:t.description,generatedAt:t.generatedAt.toISOString(),version:"1.0.0",entries:t.entries.map((o)=>({name:o.name,kind:o.kind,signature:o.signature,description:o.jsdoc.description,isExported:o.isExported,isDefault:o.isDefault,deprecated:o.jsdoc.deprecated,since:o.jsdoc.since,category:o.jsdoc.category,params:o.jsdoc.params,returns:o.jsdoc.returns,examples:o.jsdoc.examples,throws:o.jsdoc.throws,see:o.jsdoc.see,tags:o.jsdoc.tags,sourceFile:o.sourceFile,sourceLine:o.sourceLine,members:o.members?.map((i)=>({name:i.name,kind:i.kind,signature:i.signature,description:i.jsdoc.description,deprecated:i.jsdoc.deprecated,params:i.jsdoc.params,returns:i.jsdoc.returns}))})),categories:n.groupByCategory?Object.fromEntries(Array.from(t.categories.entries()).map(([o,i])=>[o,i.map((a)=>a.name)])):void 0};return JSON.stringify(s,null,2)}function mr(t){let n={id:0,name:t.title,kind:1,kindString:"Project",flags:{},children:t.entries.map((s,o)=>({id:o+1,name:s.name,kind:y(s.kind),kindString:s.kind,flags:{isExported:s.isExported,isDefault:s.isDefault},comment:s.jsdoc.description?{summary:[{kind:"text",text:s.jsdoc.description}],blockTags:s.jsdoc.deprecated?[{tag:"@deprecated",content:[{kind:"text",text:s.jsdoc.deprecated}]}]:void 0}:void 0,sources:s.sourceFile?[{fileName:s.sourceFile,line:s.sourceLine||1,character:0}]:void 0,signatures:s.kind==="function"?[{id:o+1000,name:s.name,kind:4096,kindString:"Call signature",parameters:s.jsdoc.params.map((i,a)=>({id:o+2000+a,name:i.name,kind:32768,kindString:"Parameter",flags:{isOptional:i.optional},type:i.type?{type:"intrinsic",name:i.type}:void 0,comment:i.description?{summary:[{kind:"text",text:i.description}]}:void 0})),type:s.jsdoc.returns?.type?{type:"intrinsic",name:s.jsdoc.returns.type}:void 0}]:void 0,children:s.members?.map((i,a)=>({id:o+3000+a,name:i.name,kind:y(i.kind),kindString:i.kind,comment:i.jsdoc.description?{summary:[{kind:"text",text:i.jsdoc.description}]}:void 0}))}))};return JSON.stringify(n,null,2)}async function Bi(t,n){e.info("Extracting documentation...");let s=await Xt(t,n);if(e.info(`Found ${s.entries.length} documented entries`),!j(n.outdir))S(n.outdir,{recursive:!0});if(n.format==="markdown")if(n.splitByModule){let o=I(s.entries);for(let[a,c]of o){let p={title:h(a,".ts"),description:`Documentation for ${a}`,entries:c,categories:new Map,generatedAt:s.generatedAt},u=Je(p,n),d=g(n.outdir,`${h(a,".ts")}.md`);f(d,u),e.info(`Generated: ${d}`)}let i=[`# ${s.title}`,"",s.description||"","","## Modules",""];for(let[a]of o){let c=h(a,".ts");i.push(`- [${c}](./${c}.md)`)}f(g(n.outdir,"README.md"),i.join(`
|
|
101
|
+
`)),e.info(`Generated: ${g(n.outdir,"README.md")}`)}else{let o=Je(s,n),i=g(n.outdir,"API.md");f(i,o),e.info(`Generated: ${i}`)}else if(n.format==="json"){let o=Qt(s,n),i=g(n.outdir,"api.json");f(i,o),e.info(`Generated: ${i}`);let a=mr(s),c=g(n.outdir,"typedoc.json");f(c,a),e.info(`Generated: ${c}`)}else{let o=Zt(s,n),i=g(n.outdir,"index.html");f(i,o),e.info(`Generated: ${i}`)}}function D(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function b(t){return{function:"Functions",variable:"Variables",interface:"Interfaces",type:"Type Aliases",class:"Classes",enum:"Enums",export:"Exports",module:"Modules"}[t]||t}function x(t){let n=new Map,s=["function","class","interface","type","enum","variable"];for(let o of s)n.set(o,[]);for(let o of t){let i=o.kind;if(!n.has(i))n.set(i,[]);n.get(i).push(o)}return n}function A(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function I(t){let n=new Map;for(let s of t){let o=s.sourceFile||"unknown";if(!n.has(o))n.set(o,[]);n.get(o).push(s)}return n}function y(t){return{function:64,variable:32,interface:256,type:4194304,class:128,enum:8,property:1024,method:2048,module:2,namespace:4}[t]||0}function Wi(t={}){return{extract:(n)=>Xt(n,t),generateMarkdown:(n)=>Je(n,t),generateHTML:(n)=>Zt(n,t),generateJSON:(n)=>Qt(n,t),parseJSDoc:Yt}}
|
|
102
|
+
export{Yt,Xt,Je,Zt,Qt,mr,Bi,Wi};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{r}from"./chunk-
|
|
2
|
+
import{r}from"./chunk-59q0p96t.js";import{existsSync as j,mkdirSync as N,readFileSync as z,writeFileSync as G}from"fs";import{dirname as K,relative as L,resolve as _}from"path";async function rs(t,e,n){let u=new Map,f=[],x=new Set,D=0,w=0,S=0,C=[];for(let i of t){let o=e.get(i);if(!o)continue;C.push({file:i,decls:r(o,i,n.keepComments)})}for(let{file:i,decls:o}of C){D+=o.length;for(let s of o)if(s.kind==="import"){w++;let c=s.source||"";if(c.startsWith("."))continue;if(!u.has(c))u.set(c,{source:c,specifiers:new Map,isTypeOnly:s.isTypeOnly||!1,isSideEffect:s.isSideEffect||!1});let l=u.get(c);if(s.specifiers)for(let h of s.specifiers){let W=h.alias||h.name;if(!l.specifiers.has(W))l.specifiers.set(W,{name:h.name,alias:h.alias,isType:h.isType||!1})}if(!s.isTypeOnly)l.isTypeOnly=!1}else if(s.isExported||s.kind==="export"){if(S++,s.kind==="export"&&s.source&&(s.source.startsWith(".")||s.source.startsWith("/")))continue;if(s.name&&x.has(s.name))continue;if(s.name)x.add(s.name);f.push({declaration:s,file:i})}}let a=[];a.push("/**"),a.push(" * Bundled TypeScript declarations"),a.push(` * Generated from ${t.length} source files`),a.push(" */"),a.push("");let T=n.importOrder||["bun"],y=Array.from(u.values()),p=Array(y.length);for(let i=0;i<y.length;i++){let o=y[i].source,s=T.length;for(let c=0;c<T.length;c++)if(o.startsWith(T[c])){s=c;break}p[i]=s}let g=y.map((i,o)=>o);g.sort((i,o)=>{let s=p[i],c=p[o];if(s!==c)return s-c;return y[i].source.localeCompare(y[o].source)});let b=g.map((i)=>y[i]);for(let i of b)if(i.isSideEffect)a.push(`import '${i.source}';`);else if(i.specifiers.size>0){let s=Array.from(i.specifiers.values()).map((l)=>{let h=l.isType?"type ":"";return l.alias?`${h}${l.name} as ${l.alias}`:`${h}${l.name}`}),c=i.isTypeOnly?"type ":"";a.push(`import ${c}{ ${s.join(", ")} } from '${i.source}';`)}if(b.length>0)a.push("");let m=new Map;for(let{declaration:i,file:o}of f){if(!m.has(o))m.set(o,[]);m.get(o).push(i)}for(let[i,o]of m){let s=L(n.cwd,i);a.push(`// From: ${s}`);for(let c of o){if(n.keepComments&&c.leadingComments)for(let l of c.leadingComments)a.push(l);a.push(F(c))}a.push("")}let d=a.join(`
|
|
3
3
|
`);return{content:d,files:t,declarationCount:D,importCount:w,exportCount:S,size:Buffer.byteLength(d,"utf8"),warnings:[]}}function F(t){if(t.text){let n=t.text.trim();if(t.isExported&&!n.startsWith("export"))n=`export ${n}`;if(!n.endsWith(";")&&!n.endsWith("}"))n+=";";return n}let e=[];if(t.isExported)e.push("export");if(t.isDefault)e.push("default");switch(t.kind){case"function":if(e.push("declare function"),e.push(t.name),t.generics)e.push(t.generics);if(e.push(`(${V(t.parameters)})`),t.returnType)e.push(`: ${t.returnType}`);break;case"variable":if(e.push("declare const"),e.push(t.name),t.typeAnnotation)e.push(`: ${t.typeAnnotation}`);break;case"interface":if(e.push("interface"),e.push(t.name),t.generics)e.push(t.generics);if(t.extends)e.push(`extends ${t.extends}`);if(e.push("{"),t.members)for(let n of t.members)e.push(` ${n.name}${n.typeAnnotation?`: ${n.typeAnnotation}`:""};`);e.push("}");break;case"type":if(e.push("type"),e.push(t.name),t.generics)e.push(t.generics);e.push("="),e.push(t.typeAnnotation||"unknown");break;case"class":if(e.push("declare class"),e.push(t.name),t.generics)e.push(t.generics);if(t.extends)e.push(`extends ${t.extends}`);if(t.implements&&t.implements.length>0)e.push(`implements ${t.implements.join(", ")}`);if(e.push("{"),t.members)for(let n of t.members)e.push(` ${F(n)}`);e.push("}");break;case"enum":if(e.push("declare enum"),e.push(t.name),e.push("{"),t.members){let n=t.members.map((u)=>u.value!==void 0?`${u.name} = ${u.value}`:u.name);e.push(` ${n.join(`,
|
|
4
|
-
`)}`)}e.push("}");break;default:return t.text||""}return e.join(" ")}function V(t){if(!t||t.length===0)return"";return t.map((e)=>{let n="";if(e.rest)n+="...";if(n+=e.name,e.optional)n+="?";if(e.type)n+=`: ${e.type}`;if(e.defaultValue)n+=` = ${e.defaultValue}`;return n}).join(", ")}async function
|
|
4
|
+
`)}`)}e.push("}");break;default:return t.text||""}return e.join(" ")}function V(t){if(!t||t.length===0)return"";return t.map((e)=>{let n="";if(e.rest)n+="...";if(n+=e.name,e.optional)n+="?";if(e.type)n+=`: ${e.type}`;if(e.defaultValue)n+=` = ${e.defaultValue}`;return n}).join(", ")}async function tn(t,e={}){let n=[],u=new Map,f=[],x=[],D=new Set,w=0,S=0,C=0;for(let p of t){if(!j(p)){n.push(`File not found: ${p}`);continue}let g=z(p,"utf-8");x.push(p);let b=g.split(`
|
|
5
5
|
`),m=[],d=0,i=!1;for(let o of b){let s=o.trim();if(!s&&!i)continue;if(s.startsWith("import ")){S++;let l=s.match(/import\s+(type\s+)?(?:\{([^}]+)\}|(\w+)|\*\s+as\s+(\w+))\s+from\s+['"]([^'"]+)['"]/);if(l){let[,h,W,q,H,A]=l;if(e.externals?.some((P)=>A.startsWith(P))){f.push(s);continue}if(A.startsWith("."))continue;if(!u.has(A))u.set(A,{source:A,specifiers:new Map,isTypeOnly:!!h,isSideEffect:!1});let E=u.get(A);if(W){let P=W.split(",").map((k)=>k.trim());for(let k of P){let[I,v]=k.split(/\s+as\s+/).map((M)=>M.trim()),R=I.startsWith("type "),O=R?I.replace("type ",""):I;E.specifiers.set(v||O,{name:O,alias:v!==O?v:void 0,isType:R})}}if(!h)E.isTypeOnly=!1}continue}if(/^(export\s+)?(declare\s+)?(interface|type|class|function|const|let|var|enum|namespace|module)\s/.test(s)){if(i=!0,m=[o],d=(o.match(/\{/g)||[]).length-(o.match(/\}/g)||[]).length,d===0&&(s.endsWith(";")||!s.includes("{"))){let l=B(s);if(!D.has(l)||!e.mergeDuplicates){if(D.add(l),f.push(o),w++,s.startsWith("export"))C++}i=!1,m=[]}}else if(i){if(m.push(o),d+=(o.match(/\{/g)||[]).length-(o.match(/\}/g)||[]).length,d<=0){let l=m.join(`
|
|
6
6
|
`),h=B(m[0]);if(!D.has(h)||!e.mergeDuplicates){if(D.add(h),f.push(l),w++,m[0].trim().startsWith("export"))C++}i=!1,m=[]}}else if(s.startsWith("export ")&&!s.includes("declare"))f.push(o),C++}}let a=[];if(e.banner)a.push(e.banner),a.push("");if(e.includeReferences&&e.references){for(let p of e.references)a.push(`/// <reference types="${p}" />`);a.push("")}let T=Array.from(u.values()).sort((p,g)=>p.source.localeCompare(g.source));for(let p of T)if(p.specifiers.size>0){let b=Array.from(p.specifiers.values()).map((d)=>{let i=d.isType?"type ":"";return d.alias?`${i}${d.name} as ${d.alias}`:`${i}${d.name}`}),m=p.isTypeOnly?"type ":"";a.push(`import ${m}{ ${b.join(", ")} } from '${p.source}';`)}if(T.length>0)a.push("");if(e.ambient&&e.moduleName){a.push(`declare module '${e.moduleName}' {`);for(let p of f){let g=p.split(`
|
|
7
7
|
`).map((b)=>` ${b.replace(/^(\s*)(export\s+)?declare\s+/,"$1$2")}`).join(`
|
|
8
8
|
`);a.push(g)}a.push("}")}else{if(e.sortDeclarations)f.sort((p,g)=>{let b=B(p),m=B(g);return b.localeCompare(m)});for(let p of f)a.push(p)}if(e.footer)a.push(""),a.push(e.footer);let y=a.join(`
|
|
9
|
-
`);return{content:y,files:x,declarationCount:w,importCount:S,exportCount:C,size:Buffer.byteLength(y,"utf-8"),warnings:n}}function B(t){let e=t.match(/(interface|type|class|function|const|let|var|enum|namespace|module)\s+(\w+)/);return e?`${e[1]}:${e[2]}`:t.trim()}async function
|
|
10
|
-
export{
|
|
9
|
+
`);return{content:y,files:x,declarationCount:w,importCount:S,exportCount:C,size:Buffer.byteLength(y,"utf-8"),warnings:n}}function B(t){let e=t.match(/(interface|type|class|function|const|let|var|enum|namespace|module)\s+(\w+)/);return e?`${e[1]}:${e[2]}`:t.trim()}async function vr(t,e,n={}){let u=await tn(t,n),f=K(e);if(!j(f))N(f,{recursive:!0});return G(e,u.content),u}function is(t={}){return{bundle:(e)=>tn(e,t),bundleAndWrite:(e,n)=>vr(e,n,{...t,output:n})}}async function ss(t,e=process.cwd()){let n=Array.isArray(t)?t:[t],u=[];for(let f of n){if(f.includes("*"))continue;let x=_(e,f);if(j(x))u.push(x)}return u}
|
|
10
|
+
export{rs,tn,vr,is,ss};
|
|
@@ -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 Sa(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 $a(o){return e.child(o)}function j(o){i=o}function Ea(){return i}function ka(o){u=o}function Ta(o){L=o}var Fi={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{},setLevel:()=>{},getLevel:()=>"silent",child:()=>Fi,time:()=>()=>{},progress:()=>{}};
|
|
3
|
+
export{Sa,e,$a,j,Ea,ka,Ta,Fi};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{lstat as d,realpath as f,stat as T}from"fs/promises";import{isAbsolute as l,normalize as g,relative as p,resolve as u}from"path";var z={rootDir:process.cwd(),maxFileSize:10485760,maxTotalSize:104857600,timeout:30000,followSymlinks:!1,maxFiles:1e4,blockedPatterns:["**/.git/**","**/node_modules/**","**/.env*","**/secrets/**","**/*.key","**/*.pem"]};class P extends Error{code;path;constructor(t,r,e){super(t);this.code=r;this.path=e;this.name="SecurityError"}}function at(t,r={}){let{rootDir:e=process.cwd()}=r,i=g(t),n=l(i)?i:u(e,i),o=u(n),s=p(e,o);if(s.startsWith("..")||l(s))throw new P(`Path traversal detected: "${t}" resolves outside root directory`,"PATH_TRAVERSAL",t);return o}function ki(t,r={}){return t.map((e)=>at(e,r))}function On(t,r={}){let e=r.blockedPatterns||z.blockedPatterns;for(let i of e)if(S(t,i))return!0;return!1}var m=new Map;function h(t){let r=m.get(t);if(r)return r;let e=t.replace(/\*\*/g,"<<GLOBSTAR>>").replace(/\*/g,"<<STAR>>").replace(/\?/g,"<<QUESTION>>");e=e.replace(/[.+^${}()|[\]\\]/g,"\\$&"),e=e.replace(/^<<GLOBSTAR>>\//,"(.*\\/)?"),e=e.replace(/\/<<GLOBSTAR>>$/,"(\\/.*)?"),e=e.replace(/\/<<GLOBSTAR>>\//g,"(\\/.*)?\\/"),e=e.replace(/<<GLOBSTAR>>/g,".*"),e=e.replace(/<<STAR>>/g,"[^/]*"),e=e.replace(/<<QUESTION>>/g,"[^/]");let i=new RegExp(`^${e}$`);return m.set(t,i),i}function S(t,r){let e=t.indexOf("\\")===-1?t:t.replace(/\\/g,"/");return h(r).test(e)}async function Ti(t,r={}){let e=r.maxFileSize??z.maxFileSize;try{let i=await T(t);if(i.size>e)throw new P(`File too large: "${t}" is ${a(i.size)}, max is ${a(e)}`,"FILE_TOO_LARGE",t);return i.size}catch(i){if(i instanceof P)throw i;throw new P(`Failed to check file size: ${t}`,"INVALID_PATH",t)}}async function Ai(t){try{return(await d(t)).isSymbolicLink()}catch{return!1}}async function Di(t,r={}){let e=r.followSymlinks??z.followSymlinks;if(await Ai(t)){if(!e)throw new P(`Symbolic links not allowed: "${t}"`,"SYMLINK_NOT_ALLOWED",t);let i=await f(t);return at(i,r)}return t}async function Ft(t,r={}){let e=at(t,r);if(On(e,r))throw new P(`Path matches blocked pattern: "${t}"`,"BLOCKED_PATTERN",t);let i=await Di(e,r),n=await Ti(i,r);return{path:i,size:n}}async function In(t,r={}){let e=r.maxFiles??z.maxFiles,i=r.maxTotalSize??z.maxTotalSize;if(t.length>e)throw new P(`Too many files: ${t.length} exceeds maximum of ${e}`,"MAX_FILES_EXCEEDED");let n=[],o=0;for(let s of t){let c=await Ft(s,r);if(n.push(c.path),o+=c.size,o>i)throw new P(`Total size exceeded: ${a(o)} exceeds maximum of ${a(i)}`,"TOTAL_SIZE_EXCEEDED")}return{paths:n,totalSize:o}}function Bt(t,r,e="Operation"){return new Promise((i,n)=>{let o=setTimeout(()=>{n(new P(`${e} timed out after ${r}ms`,"TIMEOUT"))},r);t.then((s)=>{clearTimeout(o),i(s)}).catch((s)=>{clearTimeout(o),n(s)})})}function Pi(t,r={}){let e=r.timeout??z.timeout;return async(i)=>{let{path:n}=await Ft(i,r);return Bt(t(n),e,`Processing ${i}`)}}function Jo(t,r={}){let e=r.timeout??z.timeout;return async(i)=>{let{paths:n}=await In(i,r);return Bt(t(n),e,`Processing ${i.length} files`)}}function Yo(t){let r=t.replace(/\\/g,"/").replace(/\0/g,"").replace(/^\/+/,"").replace(/^[A-Z]:/i,""),e="";while(e!==r)e=r,r=r.replace(/\.\.\/|\.\.$/g,"").replace(/\/+/g,"/");return r.replace(/^\/+|\/+$/g,"")}function Xo(t){if(t.includes("\x00"))return!1;if(g(t).includes(".."))return!1;if(l(t)&&!t.startsWith(process.cwd()))return!1;return!0}function a(t){if(t===0)return"0 B";let r=["B","KB","MB","GB"],e=1024,i=Math.floor(Math.log(t)/Math.log(e));return`${Number.parseFloat((t/e**i).toFixed(2))} ${r[i]}`}function Zo(t={}){let r={...z,...t};return{validatePath:(e)=>at(e,r),validatePaths:(e)=>ki(e,r),validateFile:(e)=>Ft(e,r),validateBatch:(e)=>In(e,r),withTimeout:(e,i)=>Bt(e,r.timeout,i),secureProcessor:(e)=>Pi(e,r),isBlocked:(e)=>On(e,r),getConfig:()=>r}}
|
|
3
|
+
export{z,P,at,ki,On,Ti,Ai,Di,Ft,In,Bt,Pi,Jo,Yo,Xo,Zo};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{r}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{r}from"./chunk-59q0p96t.js";import{l}from"./chunk-mzpbqdd2.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 ii(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 js(e,o={}){let i=performance.now(),{maxConcurrency:t=4,rootDir:n=process.cwd(),config:s={},onProgress:c,onError:a}=o,g=await ii(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 Gs(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 si(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 oi(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 Vs(e){let o=oi(e),i=si(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{ii,js,Gs,si,oi,Vs};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{f,be}from"./chunk-587w6ktw.js";import{zt,Ut,n,
|
|
2
|
+
import{f,be}from"./chunk-587w6ktw.js";import{zt,Ut,n,_e,K}from"./chunk-ywzc3ym6.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?
|
|
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?K(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&&
|
|
13
|
+
* \`\`\``;else u=`@defaultValue \`${m}\``}}else if(o&&i&&t.typeAnnotation&&_e(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 Hn(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 Kn(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,Hn,Kn,he};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{t,d,k}from"./chunk-r7qq9579.js";import{E}from"./chunk-9hz32qxh.js";function D(n){return typeof n==="string"?k(n,"'"):String(n)}function va(n,y,m=new Map){let o=t(n),e=new Map(m),i=new Map,f=[],c=1,p=0,q=0;for(let r=1;r<o.length;r++){let K=o[r],v=n.slice(K.start,K.end);if(K.kind==="punctuation"&&p===0&&(v===","||v==="}")){let l=o.slice(c,r),a=l[0];if(a){let u=a.kind==="quoted"?d(n.slice(a.start,a.end)):n.slice(a.start,a.end),h=l.findIndex((g)=>g.kind==="punctuation"&&n[g.start]==="="),s=q;if(h>=0){let g=l.slice(h+1),C="",b=l[h].end;for(let x=0;x+2<g.length;x++){let[M,A,B]=g.slice(x,x+3);if(M.kind!=="word"||B.kind!=="word"||n.slice(A.start,A.end)!==".")continue;let S=e.get(`${n.slice(M.start,M.end)}.${n.slice(B.start,B.end)}`);if(S===void 0||typeof S==="object")continue;C+=n.slice(b,M.start)+D(S),b=B.end,x+=2}C+=n.slice(b,l.at(-1).end),s=E(C,e),f.push({start:l[h].start,end:l.at(-1).end,text:s===void 0?"":`= ${D(s)}`})}else if(s!==void 0)f.push({start:a.end,end:a.end,text:` = ${D(s)}`});if(q=typeof s==="number"?s+1:void 0,u!==void 0){if(e.delete(u),e.delete(`${y}.${u}`),s!==void 0)i.set(u,s),e.set(u,s),e.set(`${y}.${u}`,s)}}c=r+1}else if(K.kind==="punctuation"){if("([{".includes(v))p++;else if(")]}".includes(v))p--}}let w=n;for(let r of f.reverse())w=w.slice(0,r.start)+r.text+w.slice(r.end);return{body:w,members:i}}function sr(n,y){let m=[...new Set([...n,...y.values()])];if(!m.some((e)=>e.kind==="enum"))return;m.sort((e,i)=>(e.start??0)-(i.start??0));let o=new Map;for(let e of m)if(e.kind==="enum"){let i=e.text.indexOf("{");if(i<0)continue;if(t(e.text.slice(0,i)).some((c)=>e.text.slice(c.start,c.end)==="declare"))continue;let f=va(e.text.slice(i),e.name,o);e.text=e.text.slice(0,i)+f.body;for(let[c,p]of f.members)o.set(`${e.name}.${c}`,p)}else if(e.kind==="variable"&&e.modifiers?.[0]==="const"&&!e.typeAnnotation&&!e.modifiers.includes("const assertion")&&typeof e.value==="string"){let i=E(e.value,o);if(i!==void 0)o.set(e.name,i)}}
|
|
3
|
+
export{va,sr};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{s}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{s}from"./chunk-6m4fpfzj.js";class qe{options;generateOptions;constructor(t={}){let{onCompile:r=!1,afterEmit:e=!0,onWatchRun:n=!1,onGenerated:o,onError:i,...a}=t;this.options={onCompile:r,afterEmit:e,onWatchRun:n,onGenerated:o,onError:i},this.generateOptions=a}apply(t){if(!this.generateOptions.outdir&&t.options.output?.path)this.generateOptions.outdir=t.options.output.path;if(!this.generateOptions.cwd&&t.options.context)this.generateOptions.cwd=t.options.context;if(!this.generateOptions.entrypoints&&t.options.entry){let e=t.options.entry;if(typeof e==="string")this.generateOptions.entrypoints=[e];else if(Array.isArray(e))this.generateOptions.entrypoints=e;else if(typeof e==="object"&&e!==null){let n=[];for(let o of Object.values(e))if(typeof o==="string")n.push(o);else if(Array.isArray(o))n.push(...o.filter((i)=>typeof i==="string"));else if(typeof o==="object"&&o!==null&&"import"in o){let i=o.import;if(typeof i==="string")n.push(i);else if(Array.isArray(i))n.push(...i)}if(n.length>0)this.generateOptions.entrypoints=n}}if(this.options.onCompile)t.hooks.compile.tap("DtsxWebpackPlugin",()=>{this.runGenerate()});if(this.options.afterEmit)t.hooks.afterEmit.tapAsync("DtsxWebpackPlugin",async(e,n)=>{await this.runGenerate(),n()});if(this.options.onWatchRun)t.hooks.watchRun.tapAsync("DtsxWebpackPlugin",async(e,n)=>{await this.runGenerate(),n()})}async runGenerate(){try{let t=await s(this.generateOptions);this.options.onGenerated?.(t)}catch(t){let r=t instanceof Error?t:Error(String(t));if(this.options.onError?.(r),!this.options.onError)console.error("[dtsx] Generation failed:",r.message)}}}function Jt(t={}){return new qe(t)}var pr=Jt,Fa=qe;
|
|
3
|
+
export{qe,Jt,pr,Fa};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ut}from"./chunk-3phg2e1n.js";import{A}from"./chunk-31t6c3q1.js";import{bn}from"./chunk-p023fhce.js";import{Te}from"./chunk-5af6meh8.js";import{le}from"./chunk-dc6thsdb.js";import y from"process";import{readdir as v}from"fs/promises";import{join as C,resolve as D}from"path";function et(){return`${String.fromCharCode(47,47,35)} sourceMappingURL=`}function Ks(n,r){throw Error(r||`Unexpected value: ${n}`)}async function X(n,r,o="lf"){let t=r.replace(/\r\n/g,`
|
|
3
3
|
`);if(!t.endsWith(`
|
|
4
4
|
`))t+=`
|
|
5
5
|
`;if(o==="crlf")t=t.replace(/\n/g,`\r
|
|
6
|
-
`);if(await
|
|
6
|
+
`);if(await ut(n,t)!==Buffer.byteLength(t,"utf8"))throw Error(`Incomplete declaration write: ${n}`)}async function ci(n){let r=n??A.root,o=await v(r,{withFileTypes:!0});return(await Promise.all(o.map((i)=>{let c=C(r,i.name);return i.isDirectory()?ci(c):c}))).flat(1/0).filter((i)=>{if(typeof i!=="string")return!1;return/\.(?:ts|tsx|mts|cts)$/.test(i)&&!/\.d\.(?:ts|mts|cts)$/.test(i)})}async function ie(n){try{let r=n?.cwd||y.cwd();return(await le(D(r,n?.tsconfigPath||"tsconfig.json"),{allowCircular:!0}))?.isolatedDeclarations??!1}catch{return!1}}function vt(n,r){let o={isValid:!0,errors:[]};for(let t of Te(n))o.errors.push({line:t.line,column:t.column,message:t.message,code:t.code});for(let t of bn(n))o.errors.push({line:t.line,column:1,message:`'${t.name}' is used but never declared or imported here, so it resolves to an error type for anything consuming this file. It is most likely an ambient global in the source project \u2014 import it explicitly. Referenced by: ${t.context}`,code:"dangling-type-reference"});return o.isValid=o.errors.length===0,o}function St(n,r,o){if(n===r)return"";let t=n.split(`
|
|
7
7
|
`),i=r.split(`
|
|
8
8
|
`),c=new Map,a=new Map;for(let e=0;e<t.length;e++)c.set(t[e],(c.get(t[e])??0)+1);for(let e=0;e<i.length;e++)a.set(i[e],(a.get(i[e])??0)+1);let g=[],u=[];for(let[e,s]of c){let m=s-(a.get(e)??0);for(let l=0;l<m;l++)g.push(e)}for(let[e,s]of a){let m=s-(c.get(e)??0);for(let l=0;l<m;l++)u.push(e)}if(g.length===0&&u.length===0)return"";let p=[`--- ${o}`,`+++ ${o}`];for(let e=0;e<g.length;e++)p.push(`- ${g[e]}`);for(let e=0;e<u.length;e++)p.push(`+ ${u[e]}`);return p.join(`
|
|
9
|
-
`)}function
|
|
9
|
+
`)}function $t(n,r,o,t){let i=n.split(`
|
|
10
10
|
`),c=[];function a(s){let l="",f=s<0?-s<<1|1:s<<1;do{let d=f&31;if(f>>>=5,f>0)d|=32;l+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d]}while(f>0);return l}let g=0,u=0,p=0,e=t.split(`
|
|
11
|
-
`).length;for(let s=0;s<i.length;s++){if(i[s].trim()===""){c.push("");continue}g=0;let l=Math.min(s,e-1),f=[],d=0-g,h=0,w=l-u,x=0-p;f.push(a(d)+a(h)+a(w)+a(x)),g=0,u=l,p=0,c.push(f.join(","))}return{version:3,file:r,sourceRoot:"",sources:[o],sourcesContent:[t],mappings:c.join(";")}}function
|
|
12
|
-
${
|
|
11
|
+
`).length;for(let s=0;s<i.length;s++){if(i[s].trim()===""){c.push("");continue}g=0;let l=Math.min(s,e-1),f=[],d=0-g,h=0,w=l-u,x=0-p;f.push(a(d)+a(h)+a(w)+a(x)),g=0,u=l,p=0,c.push(f.join(","))}return{version:3,file:r,sourceRoot:"",sources:[o],sourcesContent:[t],mappings:c.join(";")}}function Et(n,r){return`${n}
|
|
12
|
+
${et()}${r}
|
|
13
13
|
`}
|
|
14
|
-
export{
|
|
14
|
+
export{et,Ks,X,ci,ie,vt,St,$t,Et};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{p}from"./chunk-v6fwy63g.js";import{existsSync as u,mkdirSync as H,readFileSync as l,renameSync as b,rmdirSync as D,rmSync as C,statSync as g,writeFileSync as S}from"fs";import{join as d,relative as h,resolve as y}from"path";var f=
|
|
2
|
+
import{p}from"./chunk-v6fwy63g.js";import{existsSync as u,mkdirSync as H,readFileSync as l,renameSync as b,rmdirSync as D,rmSync as C,statSync as g,writeFileSync as S}from"fs";import{join as d,relative as h,resolve as y}from"path";var f=30,m=".dtsx-cache",v="manifest.json";function Hr(t){try{C(d(t,v),{force:!0});try{D(t)}catch{}}catch{}}class Ze{cacheDir;manifestPath;manifest=null;configHash;constructor(t,n){this.cacheDir=y(t.cwd,t.cacheDir??m),this.manifestPath=d(this.cacheDir,v),this.configHash=this.hashConfig(t,n)}hashConfig(t,n){let s={resolutionContext:n,keepComments:t.keepComments,importOrder:t.importOrder,outputStructure:t.outputStructure,moduleSpecifierMode:t.moduleSpecifierMode??"preserve",root:y(t.cwd,t.root),exclude:t.exclude??[],isolatedDeclarations:t.isolatedDeclarations,declarationMap:t.declarationMap,indentStyle:t.indentStyle,indentSize:t.indentSize,prettier:t.prettier,typeMappings:t.typeMappings?{includeDefaults:t.typeMappings.includeDefaults,presets:t.typeMappings.presets,cacheKey:t.typeMappings.cacheKey,rules:t.typeMappings.rules.map((e)=>({pattern:typeof e.pattern==="string"?{kind:"string",value:e.pattern}:{kind:"regex",source:e.pattern.source,flags:e.pattern.flags},replacement:e.replacement,global:e.global,priority:e.priority,hasCondition:Boolean(e.condition)}))}:void 0,lineEnding:t.lineEnding,normalizeOutput:t.normalizeOutput,declarationOrder:t.declarationOrder,plugins:t.plugins?.map((e)=>({name:e.name,version:e.version,cacheKey:e.cacheKey}))};return String(p(JSON.stringify(s)))}hashString(t){return String(p(t))}load(){try{if(!u(this.manifestPath))return!1;let t=l(this.manifestPath,"utf-8"),n=JSON.parse(t);if(n.version!==f)return!1;if(n.configHash!==this.configHash)return!1;if(!n.entries||typeof n.entries!=="object"||Array.isArray(n.entries))return!1;return this.manifest=n,!0}catch{return!1}}save(){if(!this.manifest)this.manifest={version:f,configHash:this.configHash,entries:{},createdAt:Date.now(),updatedAt:Date.now()};if(this.manifest.updatedAt=Date.now(),!u(this.cacheDir))H(this.cacheDir,{recursive:!0});let t=`${this.manifestPath}.${process.pid}.tmp`;try{S(t,JSON.stringify(this.manifest,null,2)),b(t,this.manifestPath)}finally{if(u(t))C(t,{force:!0})}}needsRegeneration(t,n){return this.getCachedIfValid(t,n)===null}getCached(t,n){return this.getCachedIfValid(t,n)}getCachedIfValid(t,n){if(!this.manifest)return null;let s=h(n,t),e=this.manifest.entries[s];if(!e)return null;if(typeof e.dtsContent!=="string"||typeof e.dtsHash!=="string"||e.configHash!==this.configHash||this.hashString(e.dtsContent)!==e.dtsHash)return null;try{let i=g(t),{mtimeMs:r,ctimeMs:a}=i;if(i.size!==e.sourceSize)return null;if(r!==e.sourceMtime||a!==e.sourceCtime){let o=l(t,"utf-8");if(this.hashString(o)!==e.sourceHash)return null;e.sourceMtime=r,e.sourceCtime=a}return e.dtsContent}catch{return null}}update(t,n,s,e){if(!this.manifest)this.manifest={version:f,configHash:this.configHash,entries:{},createdAt:Date.now(),updatedAt:Date.now()};let i=h(e,t),r,a,o;try{let c=g(t);r=c.mtimeMs,a=c.ctimeMs,o=c.size}catch{r=Date.now(),a=r,o=Buffer.byteLength(n)}this.manifest.entries[i]={sourcePath:i,sourceHash:this.hashString(n),sourceMtime:r,sourceCtime:a,sourceSize:o,dtsContent:s,dtsHash:this.hashString(s),generatedAt:Date.now(),configHash:this.configHash}}remove(t,n){if(!this.manifest)return;let s=h(n,t);delete this.manifest.entries[s]}clear(){this.manifest=null,Hr(this.cacheDir)}getStats(){if(!this.manifest)return{entries:0,size:0};let t=Object.keys(this.manifest.entries).length,n=0;for(let s of Object.values(this.manifest.entries))n+=s.dtsContent.length;return{entries:t,size:n}}prune(t,n){if(!this.manifest)return 0;let s=0,e=new Set(Array.from(t).map((i)=>h(n,i)));for(let i of Object.keys(this.manifest.entries))if(!e.has(i))delete this.manifest.entries[i],s++;return s}}function wt(t){let n=d(t,".gitignore");try{let s="";if(u(n))s=l(n,"utf-8");if(!s.split(/\r?\n/).some((i)=>i.trim()===m||i.trim()===`${m}/`)){let i=s.trimEnd(),r=`${i}${i?`
|
|
3
3
|
|
|
4
4
|
`:""}# dtsx cache
|
|
5
5
|
${m}/
|
|
6
6
|
`;S(n,r)}}catch{}}
|
|
7
|
-
export{
|
|
7
|
+
export{Hr,Ze,wt};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function
|
|
2
|
+
function Ne(h){let a="",i=0,e=0;while(i<h.length){let r=h.charCodeAt(i);if(e){if(a+=h[i],r===92&&i+1<h.length){a+=h[i+1],i+=2;continue}if(r===e)e=0;i++;continue}if(r===34){e=r,a+=h[i++];continue}if(r===47&&h.charCodeAt(i+1)===47){i+=2;while(i<h.length&&h.charCodeAt(i)!==10&&h.charCodeAt(i)!==13)i++;continue}if(r===47&&h.charCodeAt(i+1)===42){i+=2;while(i+1<h.length&&!(h.charCodeAt(i)===42&&h.charCodeAt(i+1)===47)){if(h.charCodeAt(i)===10)a+=`
|
|
3
3
|
`;i++}i=Math.min(i+2,h.length);continue}if(r===44){let c=i+1;while(c<h.length){while(c<h.length&&h.charCodeAt(c)<=32)c++;if(h.charCodeAt(c)===47&&h.charCodeAt(c+1)===47){c+=2;while(c<h.length&&h.charCodeAt(c)!==10&&h.charCodeAt(c)!==13)c++;continue}if(h.charCodeAt(c)===47&&h.charCodeAt(c+1)===42){c+=2;while(c+1<h.length&&!(h.charCodeAt(c)===42&&h.charCodeAt(c+1)===47))c++;c=Math.min(c+2,h.length);continue}break}let t=h.charCodeAt(c);if(t===93||t===125){i++;continue}}a+=h[i++]}return a}
|
|
4
|
-
export{
|
|
4
|
+
export{Ne};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ur}from"./chunk-r7qq9579.js";import{L,N}from"./chunk-rb602c8k.js";import{O,I}from"./chunk-k2axmtyh.js";import{p}from"./chunk-v6fwy63g.js";import{M,F}from"./chunk-jhjj15ey.js";var y=100,h=0,e=new Map;function Me(n,s,c=!0,i=!1,l){if(L(s??""))n=N(n);else if(O(s??""))n=I(n);let f=p(n),m=JSON.stringify([s,c,i,[...l??[]].sort()]),a=e.get(m);if(a&&a.contentHash===f)return a.lastAccess=++h,a.declarations;let g=i?M(n,s,c):F(n,s,c,l);if(e.set(m,{declarations:g,contentHash:f,lastAccess:++h}),e.size>y){let S=Math.max(1,Math.ceil(e.size*0.1)),r=[];for(let[t,o]of e)r.push([t,o.lastAccess]);r.sort((t,o)=>t[1]-o[1]);for(let t=0;t<S&&t<r.length;t++)e.delete(r[t][0])}return g}function vn(){e.clear(),ur()}
|
|
3
|
+
export{Me,vn};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{t}from"./chunk-r7qq9579.js";function C(n,o){if(o.kind!=="punctuation")return 0;let r=n.slice(o.start,o.end);if("([{<".includes(r))return 1;if(")]}".includes(r)||r===">"&&n[o.start-1]!=="=")return-1;return 0}function je(n){if(!n.includes("?"))return n;let o=n.trim(),r=o.startsWith("(")&&o.endsWith(")"),u=n.indexOf(o)+(r?1:0),s=r?o.slice(1,-1):o,a=[[]],h=0;for(let i of t(s)){if(i.kind==="punctuation"&&s[i.start]===","&&h===0)a.push([]);else a[a.length-1].push(i);h+=C(s,i)}let m=a.map((i)=>{let l=0,d=-1;for(let[D,A]of i.entries()){if(l===0&&A.kind==="punctuation"&&s[A.start]===":"){d=D;break}l+=C(s,A)}let f=d>0&&s[i[d-1].start]==="?"?i[d-1]:void 0,y=i[0]?s.slice(i[0].start,i[0].end):"",q=i[0]&&s.startsWith("...",i[0].start);return{tokens:i,colon:d,question:f,required:i.length>0&&!f&&!q&&y!=="this"}}),c=-1;for(let[i,l]of m.entries())if(l.required)c=i;let e=[];for(let[i,l]of m.entries()){if(i>=c||!l.question||l.colon<0)continue;let d=l.tokens[l.colon+1],f=l.tokens.at(-1);if(!d||!f)continue;e.push({start:u+l.question.start,end:u+l.question.end,text:""},{start:u+d.start,end:u+d.start,text:"("},{start:u+f.end,end:u+f.end,text:") | undefined"})}if(!e.length)return n;let g=[],p=0;for(let i of e)g.push(n.slice(p,i.start),i.text),p=i.end;return g.push(n.slice(p)),g.join("")}function x(n){return n>=65&&n<=90||n>=97&&n<=122||n===95||n===36}function k(n,o){if(o>=n.length||!x(n.charCodeAt(o)))return o;let r=o+1;while(r<n.length&&(x(n.charCodeAt(r))||n.charCodeAt(r)>=48&&n.charCodeAt(r)<=57))r++;return r}function b(n,o){let r=o;while(r<n.length&&n.charCodeAt(r)<=32)r++;return r}function we(n,o){if(o.trim()!=="{}")return null;let r=n.trim();if(r.length<2||r[0]!=="{"||r[r.length-1]!=="}")return null;let u=r.slice(1,-1),s=[],a=0,h=0;for(let c=0;c<u.length;c++){let e=u.charCodeAt(c);if(e===34||e===39||e===96){c++;while(c<u.length&&u.charCodeAt(c)!==e){if(u.charCodeAt(c)===92)c++;c++}if(c>=u.length)return null;continue}if(e===47&&(u.charCodeAt(c+1)===47||u.charCodeAt(c+1)===42))return null;if(e===40||e===91||e===123)a++;else if(e===41||e===93||e===125){if(--a<0)return null}else if(e===44&&a===0)s.push(u.slice(h,c)),h=c+1}if(a!==0)return null;if(u.slice(h).trim()||s.length===0)s.push(u.slice(h));let m=[];for(let c of s){let e=c.trim(),g=k(e,0);if(g===0)return null;let p=e.slice(0,g),i=p,l=b(e,g);if(e.charCodeAt(l)===58){let f=b(e,l+1),y=k(e,f);if(y===f)return null;i=e.slice(f,y),l=b(e,y)}if(e.charCodeAt(l)!==61||e.charCodeAt(l+1)===61||e.charCodeAt(l+1)===62)return null;let d=e.slice(l+1).trim();if(!d)return null;m.push({key:p,alias:i,value:d})}return m}function Ge(n,o){let r=n.map((s)=>s.key===s.alias?s.key:`${s.key}: ${s.alias}`).join(", "),u=n.map((s)=>{let a=o(s.value),h=a==="unknown"||a==="any"?a:`${a.includes("=>")?`(${a})`:a} | undefined`;return`${s.key}?: ${h}`}).join("; ");return`{ ${r} }?: { ${u} }`}
|
|
3
|
+
export{je,we,Ge};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,m}from"./chunk-
|
|
2
|
+
import{t,m}from"./chunk-r7qq9579.js";import{Ve}from"./chunk-8z4tvwyd.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"&&["is","extends","keyof","readonly"].includes(g))return!0;if(g==="|"||g==="&"||g==="?"||g===":")return!0;let o=u[u.length-2];return g===">"&&o!==void 0&&l.slice(o.start,o.end)==="="}function U(l){return C(l,m(l))}function er(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 tr(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 nr(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 Ve(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,Vt,
|
|
4
|
+
export{ft,Vt,U,er,tr,nr};
|