@cxl/build 1.0.0-beta.3 → 1.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/3doc.js +58 -279
- package/README.md +2 -2
- package/audit.d.ts +1 -0
- package/chunk-CC5X4GUA.js +44 -0
- package/chunk-YBEJVJDA.js +4 -0
- package/index.bundle.js +1 -1
- package/library-UNJOIIL7.js +1 -0
- package/license-Apache-2.0.md +202 -0
- package/license-GPL-3.0.md +674 -0
- package/npm.d.ts +1 -0
- package/package.json +6 -6
- package/render-F5OGOROK.js +1 -0
- package/{render-html-WNP2FSL3-HEUQV5A2.js → render-html-27TCOWOE-TXOI62NA.js} +1 -1
- package/{render-summary-ULILIVXW-MBBMA5KL.js → render-summary-H5JT7BDG-ETDG4C5Q.js} +1 -1
- package/spec-browser.js +132 -0
- package/chunk-2QIYZERK.js +0 -24
- package/chunk-BJVTLF6O.js +0 -4
- package/library-STR4IXQL.js +0 -1
package/README.md
CHANGED
|
@@ -6,10 +6,10 @@ A flexible build system that executes configurable build tasks producing output
|
|
|
6
6
|
|
|
7
7
|
## Project Details
|
|
8
8
|
|
|
9
|
-
- Branch Version: [1.0.0-beta.
|
|
9
|
+
- Branch Version: [1.0.0-beta.5](https://npmjs.com/package/@cxl/build/v/1.0.0-beta.5)
|
|
10
10
|
- License: GPL-3.0
|
|
11
11
|
- Documentation: [Link](https://cxlio.github.io/cxl/build)
|
|
12
|
-
- Report Issues: [Github](https://github.com/cxlio/
|
|
12
|
+
- Report Issues: [Github](https://github.com/cxlio/open/issues)
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
package/audit.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (): Promise<void>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import{basename as Wr,join as _}from"path";import{readFileSync as W}from"fs";var $={},Xr=Symbol("terminator");function et(e,t){let r=!1,n={error:o,unsubscribe:s,get closed(){return r},signal:T(),next(i){if(!r)try{e.next?.(i)}catch(c){o(c)}},complete(){if(!r)try{e.complete?.()}finally{s()}}};e.signal?.subscribe(s);function o(i){if(r)throw i;if(!e.error)throw s(),i;try{e.error(i)}finally{s()}}function s(){r||(r=!0,n.signal.next())}try{if(t?.(n))throw new Error("Unsubscribe function result is deprectaed")}catch(i){o(i)}return n}function ue(...e){return t=>e.reduce((r,n)=>n(r),t)}var u=class{__subscribe;constructor(t){this.__subscribe=t}then(t,r){return nt(this).then(t,r)}pipe(...t){return t.reduce((r,n)=>n(r),this)}subscribe(t){return et(!t||typeof t=="function"?{next:t}:t,this.__subscribe)}},I=class extends u{closed=!1;signal=T();observers=new Set;constructor(){super(t=>this.onSubscribe(t))}next(t){if(!this.closed)for(let r of Array.from(this.observers))r.closed||r.next(t)}error(t){if(!this.closed){this.closed=!0;let r=!1,n;for(let o of Array.from(this.observers))try{o.error(t)}catch(s){r=!0,n=s}if(r)throw n}}complete(){this.closed||(this.closed=!0,Array.from(this.observers).forEach(t=>t.complete()),this.observers.clear())}onSubscribe(t){this.closed?t.complete():(this.observers.add(t),t.signal.subscribe(()=>this.observers.delete(t)))}},z=class extends u{closed=!1;observers=new Set;constructor(){super(t=>{this.closed?(t.next(),t.complete()):this.observers.add(t)})}next(){if(!this.closed){this.closed=!0;for(let t of Array.from(this.observers))t.closed||(t.next(),t.complete());this.observers.clear()}}};var Y=class extends I{bufferSize;buffer=[];hasError=!1;lastError;constructor(t=1/0){super(),this.bufferSize=t}error(t){this.hasError=!0,this.lastError=t,super.error(t)}next(t){return this.buffer.length===this.bufferSize&&this.buffer.shift(),this.buffer.push(t),super.next(t)}onSubscribe(t){this.observers.add(t),this.buffer.forEach(r=>t.next(r)),this.hasError?t.error(this.lastError):this.closed&&t.complete(),t.signal.subscribe(()=>this.observers.delete(t))}},H=class extends I{$value=$;get hasValue(){return this.$value!==$}get value(){if(this.$value===$)throw new Error("Reference not initialized");return this.$value}next(t){return this.$value=t,super.next(t)}onSubscribe(t){!this.closed&&this.$value!==$&&t.next(this.$value),super.onSubscribe(t)}},K=class extends Error{message="No elements in sequence"};function T(){return new z}function P(e){return new u(t=>{e().subscribe(t)})}function fe(e){return new u(t=>{for(let r of e)t.closed||t.next(r);t.complete()})}function pe(e){return new u(t=>{e.then(r=>{t.closed||t.next(r),t.complete()}).catch(r=>t.error(r))})}function J(e){return P(()=>pe(e()))}function tt(e){return new u(t=>{for(let r of e)t.closed||t.next(r);t.complete()})}function de(e){return e instanceof u?e:Array.isArray(e)?fe(e):e instanceof Promise?pe(e):tt(e)}function R(...e){return fe(e)}function rt(e){return new Promise((t,r)=>{let n=$;e.subscribe({next:o=>n=o,error:o=>r(o),complete:()=>t(n)})})}function nt(e){return rt(e).then(t=>t===$?void 0:t)}function j(e,t){return v(r=>({next:e(r),unsubscribe:t}))}function v(e){return t=>new u(r=>{let n=e(r,t);r.signal.subscribe(()=>n.unsubscribe?.()),n.error||(n.error=r.error),n.complete||(n.complete=r.complete),n.signal=r.signal,t.subscribe(n)})}function X(e){return j(t=>r=>t.next(e(r)))}function Q(e,t){return v(r=>{let n=t,o=0;return{next(s){n=e(n,s,o++)},complete(){r.next(n),r.complete()}}})}function ot(e){return v(t=>{let r=!0,n;return{next(o){r&&(r=!1,t.next(o),n=setTimeout(()=>r=!0,e))},unsubscribe:()=>clearTimeout(n)}})}function st(e){return new u(t=>{let r=setTimeout(()=>{t.next(),t.complete()},e);t.signal.subscribe(()=>clearTimeout(r))})}function it(e,t=st){return me(r=>t(e).map(()=>r))}function me(e){return t=>E(r=>{let n=!1,o=!1,s,i=()=>{s?.next(),n=!1,o&&r.complete()},c=T();r.signal.subscribe(()=>{i(),c.next()}),t.subscribe({next(a){i(),s=T(),n=!0,e(a).subscribe({next:r.next,error:r.error,complete:i,signal:s})},error:r.error,complete(){o=!0,n||r.complete()},signal:c})})}function ct(e){return t=>E(r=>{let n=r.signal,o=0,s=0,i=!1;t.subscribe({next:c=>{o++,e(c).subscribe({next:r.next,error:r.error,complete:()=>{s++,i&&s===o&&r.complete()},signal:n})},error:r.error,complete(){i=!0,s===o&&r.complete()},signal:n})})}function at(e){return v(t=>{let r=!0;return{next(n){r&&(r=!1,e(n).subscribe({next:t.next,error:t.error,complete:()=>r=!0,signal:t.signal}))}}})}function Z(e){return j(t=>r=>{e(r)&&t.next(r)})}function lt(e){return j(t=>r=>{e-- >0&&!t.closed&&t.next(r),(e<=0||t.closed)&&t.complete()})}function ut(e){return j(t=>r=>{!t.closed&&e(r)?t.next(r):t.complete()})}function ft(){let e=!1;return v(t=>({next(r){e||(e=!0,t.next(r),t.complete())},complete(){t.closed||t.error(new K)}}))}function ee(e){return j(t=>r=>{e(r),t.next(r)})}function pt(e){return v((t,r)=>{let n,o={next:t.next,error(s){try{if(t.closed)return;let i=e(s,r);i&&(n?.next(),n=T(),i.subscribe({...o,signal:n}))}catch(i){t.error(i)}},unsubscribe:()=>n?.next()};return o})}function dt(){return j(e=>{let t=$;return r=>{r!==t&&(t=r,e.next(r))}})}function mt(){return e=>{let t=new Y(1),r=!1;return E(n=>{t.subscribe(n),r||(r=!0,e.subscribe(t))})}}function gt(){return e=>{let t,r=0;function n(){--r===0&&t?.signal.next()}return E(o=>{o.signal.subscribe(n),r++===0?(t=yt(),t.subscribe(o),e.subscribe(t)):t.subscribe(o)})}}function ht(){return e=>{let t=new I,r,n,o=!1,s=!1;return E(i=>{s?(i.next(n),i.complete()):t.subscribe(i),r??=e.subscribe({next:c=>{o=!0,n=c},error:i.error,complete(){s=!0,o&&t.next(n),t.complete()},signal:i.signal})})}}function ge(...e){return e.length===1?e[0]:new u(t=>{let r=e.length;for(let n of e)t.closed||n.subscribe({next:t.next,error:t.error,complete(){r--===1&&t.complete()},signal:t.signal})})}function wt(e){return v(t=>({next:t.next,unsubscribe:e}))}function xt(){return Z(()=>!1)}var O=new u(e=>e.complete());function E(e){return new u(e)}function yt(){return new H}var le={catchError:pt,debounceTime:it,distinctUntilChanged:dt,exhaustMap:at,filter:Z,finalize:wt,first:ft,ignoreElements:xt,map:X,mergeMap:ct,publishLast:ht,reduce:Q,share:gt,shareLatest:mt,switchMap:me,take:lt,takeWhile:ut,tap:ee,throttleTime:ot};for(let e in le)u.prototype[e]=function(...t){return this.pipe(le[e](...t))};import{resolve as vt}from"path";import*as y from"inspector";function bt(e){let t=[];for(let r of e){let n=0,o=0;for(let s of r.functions)for(let i of s.ranges){let c=i.endOffset-i.startOffset;n+=c,i.count&&(o+=c)}t.push({url:r.url,functions:r.functions,blockTotal:n,blockCovered:o})}return t}async function $t(e){let t=[],r=/\/node_modules\//;for(let n of e){let o=n.url;r.test(o)||t.push({url:o,functions:n.functions})}return bt(t)}function he(e){let t=0,r=e.results.map(o=>(o.success===!1&&t++,{message:o.message,success:o.success,data:o.data,stack:o.stack})),n=(e.only.length?e.only:e.tests).map(o=>{let s=he(o);return t+=s.failureCount,s});return r.length===0&&e.tests.length===0&&(t++,r.push({success:!1,message:"No assertions found"})),{name:e.name,failureCount:t,results:r,tests:n,runTime:e.runTime,timeout:e.timeout}}async function L(e,t){let r=he(e),n=t&&await $t(t);return{success:r.failureCount===0,testReport:r,coverage:n}}function A(e,t,r={}){return new Promise((n,o)=>{e.post(t,r,(s,i)=>s?o(s):n(i))})}async function Et(e,t){await A(e,"Profiler.enable"),await A(e,"Profiler.startPreciseCoverage",{detailed:!0});let r=await t(),n=await A(e,"Profiler.takePreciseCoverage");return await A(e,"Profiler.stopPreciseCoverage"),await A(e,"Profiler.disable"),{coverage:n.result,result:r}}async function te(e){async function t(){let s=(await import(o)).default;return s.run().then(()=>s)}let r=e.entryFile,n=new y.Session;e.log(`Runner: Node ${process.version}`);let o=vt(r);if(e.log(`Suite: ${o}`),e.inspect&&(y.open(),console.log(`Waiting for debugger (${y.url()})`),y.waitForDebugger()),n.connect(),e.ignoreCoverage){let s=await t();return L(s)}else{let{result:s,coverage:i}=await Et(n,t);return process.argv.includes("--inspect")&&(console.log("Press any key to continue"),await new Promise(c=>process.stdin.once("data",c))),L(s,i)}}import*as $e from"puppeteer";import{readFile as ve,writeFile as we,mkdir as xe}from"fs/promises";import{resolve as St,relative as Ee,join as kt,extname as Dt}from"path";import{createRequire as Pt}from"module";async function jt(e){await Promise.all([e.coverage.startJSCoverage({reportAnonymousScripts:!0})])}async function Ct(e,t){let r=e.type(),{url:n,lineNumber:o}=e.location(),s=o!==void 0?` (${o})`:"";t.log(`console ${r}: ${n}${s}`);for(let i of e.args())try{console.log(await i.evaluate(c=>c instanceof Error?{message:c.message,stack:c.stack}:JSON.stringify(c,null,2)))}catch{console.log(i.toString())}}async function Nt(e){return await(await e.createBrowserContext()).newPage()}async function Ft(e,t,r){function n(a){let l=a.type;if(l==="figure")try{return Lt(o,a,e)}catch(p){return{success:!1,message:String(p)||"Unknown Error"}}else{if(l==="hover"||l==="tap"||l==="click")return o.$(a.element).then(p=>{if(!p)throw new Error(`Element for selector "${a.element}" not found.`);return p[l]()}).then(()=>({success:!0,message:"Element"}));if(l==="type"||l==="press")return o.$(a.element).then(p=>{if(!p)throw new Error(`Element for selector "${a.element}" not found.`);return p[l](a.value)}).then(()=>({success:!0,message:"Element"}));if(l==="testElement")return{success:!0,message:"testElement supported"};if(l==="concurrency")return{success:!0,message:"Concurrency",concurrency:r}}return{success:!1,message:`Feature not supported: ${l}`}}let o=await Nt(t),s=e.vfsRoot?`./${Ee(e.vfsRoot,e.entryFile)}`:e.entryFile;o.on("console",a=>Ct(a,e)),o.on("pageerror",a=>e.log(a)),o.on("requestfailed",a=>{e.log(`requestfailed: ${a.method()} ${a.url()} ${a.failure()?.errorText}`)}),o.exposeFunction("__cxlRunner",n),await jt(o),e.browserUrl&&await Se(e,o,e.browserUrl),await o.bringToFront();let i=await It(o,e,s);if(!i)throw new Error("Invalid suite");let c=e.ignoreCoverage?void 0:await Rt(o,e);return{suite:i,coverage:c}}function Bt(e,t){let r=t.vfsRoot?St(t.vfsRoot):process.cwd(),n=Pt(r+"/");function o(s){try{let i=n.resolve(s.slice(1));if(i)return Ee(r,i)}catch{}return s}e.on("request",async s=>{try{let i=new URL(s.url());if(s.method()==="GET"&&i.hostname==="cxl-tester"){if(i.pathname==="/"||i.pathname==="/favicon.ico")return s.respond({status:200,body:""});let c=o(i.pathname);if(c!==i.pathname)return s.respond({status:301,headers:{location:"/"+c}});let a=await ve(kt(r,c),"utf8"),l=Dt(c);l===".js"&&!t.sources.has(i.href)&&t.sources.set(i.href,{path:c,source:a}),s.respond({status:200,contentType:l===".js"?"text/javascript":"text/plain",body:a})}else s.continue()}catch{t.log(`Error handling request ${s.method()} ${s.url()}`),s.respond({status:500})}})}function Se(e,t,r){return t.goto(r)}async function It(e,t,r){return await e.setRequestInterception(!0),Bt(e,t),await Se(t,e,"https://cxl-tester"),t.importmap&&await e.addScriptTag({type:"importmap",content:t.importmap}),e.evaluate(`(async entry => {
|
|
2
|
+
const r = (await import(entry)).default;
|
|
3
|
+
await r.run();
|
|
4
|
+
return r.toJSON();
|
|
5
|
+
})('${r}')`)}function re(e,t,r){return{startOffset:e,endOffset:t,count:r}}function Tt(e){let t=[],r=0;for(let n of e.ranges)n.start>r&&t.push(re(r,n.start,0)),t.push(re(n.start,n.end,1)),r=n.end;return r<e.text.length&&t.push(re(r,e.text.length,0)),t}async function Rt(e,t){return(await e.coverage.stopJSCoverage()).flatMap(n=>{let o=t.sources.get(n.url);return o?{url:o.path,functions:[{functionName:"",ranges:Tt(n),isBlockCoverage:!0}]}:[]})}var ye=Promise.resolve();async function be(e){let t=(await import("./png-BPHNXF4V.js")).PNG;return new Promise((r,n)=>{new t().parse(Buffer.from(e),(s,i)=>{s?n(s):r(i)})})}function Ot(e,t,r){return new Promise((n,o)=>{let s=`#${t}`;ye=ye.then(()=>e.$eval(s,(i,c)=>{i.innerHTML=c,i.style.zIndex="10",i.getRootNode()?.activeElement?.blur?.()},r).then(async()=>(await e.waitForNetworkIdle({idleTime:120,timeout:5e3}),await e.waitForFunction("document.fonts?.ready"),await e.mouse.move(350,-100),(await e.$(s))?.screenshot({type:"png",encoding:"binary"}))).then(i=>{ArrayBuffer.isView(i)?n(i):o("Invalid value returned by screenshot()")},i=>o(i)))})}async function Lt(e,t,r){let{name:n,domId:o,html:s}=t,i=t.baseline=`${r.baselinePath||"spec"}/${n}.png`,c=`spec/${n}.png`,[a,l]=await Promise.all([ve(i).catch(()=>{}),Ot(e,o,s)]);if(l&&xe("spec").catch(()=>!1).then(()=>we(c,l)),(!a||r.updateBaselines)&&l&&r.baselinePath)xe(r.baselinePath).catch(()=>!1).then(()=>we(i,l));else if(a&&l&&r.baselinePath){let[p,k]=await Promise.all([be(a),be(l)]),B=p.data,M=k.data,g=B.length;if(g!==M.length)return{success:!1,message:`Screenshot should match baseline: Different Size (${p.width}x${p.height} vs ${k.width}x${k.height})`,data:t};for(let D=0;D<g;D++)if(B.readUInt8(D)!==M.readUInt8(D))return{success:!1,message:"Screenshot should match baseline",data:t}}return{success:!0,message:"Screenshot should match baseline",data:t}}async function ne(e){let t=["--no-sandbox","--disable-setuid-sandbox","--disable-gpu","--font-render-hinting=none","--disable-font-subpixel-positioning","--animation-duration-scale=0","--force-device-scale-factor=1","--window-size=1280,1024","--disable-infobars","--hide-scrollbars","--blink-settings=imagesEnabled=true","--enable-font-antialiasing","--disable-features=Translate,BackForwardCache,ColorPicker,SharedArrayBuffer,InterestCohort,NotificationIndicator,Prerender2","--disable-background-timer-throttling","--disable-backgrounding-occluded-windows","--disable-renderer-backgrounding","--mute-audio","--disable-extensions"];e.disableSecurity&&t.push("--disable-web-security");let r=await $e.launch({headless:!0,args:t,timeout:5e3});try{e.log(`Puppeteer ${await r.version()}`);let{suite:n,coverage:o}=await Ft(e,r,0);return L(n,o)}finally{await r.close()}}function ke(e){return e.node?te(e):ne(e)}import{readFile as At,stat as dn,mkdir as mn}from"fs/promises";import{spawn as Gt}from"child_process";var De={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]},x=Object.keys(De).reduce((e,t)=>{let r=De[t],n="\x1B["+r[0]+"m",o="\x1B["+r[1]+"m";return e[t]=s=>n+s+o,e},{}),je='"(?:[^"\\\\]|\\\\.)*"',Mt="-(\\w\\w+)",Ce=`\\s*=?\\s*(${je}|[^-][^\\s]*)?`,Jt=`-(\\w)${Ce}`,Vt=`--(\\w+)${Ce}`,hn=new RegExp(`\\s*(?:${Mt}|${Jt}|${Vt}|(${je}|[^\\s]+))`,"g");function Pe(){return process.hrtime.bigint()}async function Ne(e){let t=Pe(),r=await(typeof e=="function"?e():e),n=0,o=Pe(),s={start:t,tasks:++n,time:o-t,result:r};return t=o,s}async function h(e,t){try{return JSON.parse(await At(e,"utf8"))}catch(r){if(t!==void 0)return t;throw r}}function Fe(e,...t){console.log(typeof e=="string"?e:e(),...t)}function d(e,t={}){return new Promise((r,n)=>{let o=Gt(e,[],{shell:!0,...t}),s="";o.stdout?.on("data",i=>s+=i?.toString()||""),o.stderr?.on("data",i=>s+=i?.toString()||""),o.on("exit",i=>{i!==0?n(s):r(s)})})}function Ut(e,t){let r=t.message;console.error(e,x.red(r)),t.stack&&console.error(t.stack)}function Be(e){let t="",r=e.results.filter(o=>(t+=o.success?x.green("."):x.red("X"),o.success===!1)),n=e.runTime>e.timeout?"brightYellow":e.runTime>e.timeout/2?"yellow":"gray";return console.group(`${e.name} ${x[n](`(${e.runTime.toFixed(2)} ms)`)} ${t}`),r.forEach(o=>Ut(e.name,o)),e.tests.forEach(Be),console.groupEnd(),r}function qt(e){console.log("Coverage Report:");for(let t of e){let r=(t.blockCovered/t.blockTotal*100).toFixed(2);console.log(`${t.url}: ${r}% (${t.blockTotal}/${t.blockCovered})`)}}function oe(e){e.coverage&&qt(e.coverage),Be(e.testReport)}import{dirname as or,relative as sr,resolve as ir}from"path";import{existsSync as cr,utimesSync as ar,writeFileSync as lr}from"fs";import{spawn as ur,execSync as Me}from"child_process";import{createRequire as fr}from"module";import{existsSync as Yt,readFileSync as Le}from"fs";import{join as Ht,resolve as Kt}from"path";import{promises as _t,readFileSync as vn}from"fs";import{basename as Wt,dirname as Sn,resolve as zt}from"path";async function Te(e){let t=await _t.readFile(e);return{path:e,source:t}}function S(e,t){return P(()=>de(Te(e).then(r=>({path:t||zt(e),source:r.source}))))}function Dn(e){return ee(t=>t.path=(e||"")+Wt(t.path))}function Pn(e,t=`
|
|
6
|
+
`){return ue(Q((r,n)=>`${r}${t}${n.source}`,""),X(r=>({path:e,source:Buffer.from(r)})))}function jn(e){return new u(t=>{Promise.all(e.map(Te)).then(r=>{r.forEach(n=>t.next(n)),t.complete()},r=>t.error(r))})}function Re(e,t,r=""){return V(`mkdir -p ${t} && rsync -au -i --delete ${e}/${r} ${t}`)}function Cn(e,t){return Ie(`zip - ${e.join(" ")}`).map(r=>({path:t,source:r}))}import{execSync as Xt}from"child_process";import*as Ae from"esbuild";var Qt=process.cwd(),C=Xt("npm prefix",{cwd:Qt}).toString().trim(),Zt={"GPL-3.0":"license-GPL-3.0.md","GPL-3.0-only":"license-GPL-3.0.md","Apache-2.0":"license-Apache-2.0.md","SEE LICENSE IN LICENSE.md":"",UNLICENSED:""};function Oe(e,t,r){for(let n of e)if(!t[n])throw new Error(`Field "${n}" missing in "${r}"`)}function se(e){return new u(t=>{Ae.build({minify:!0,bundle:!0,splitting:!0,format:"esm",tsconfig:"tsconfig.json",platform:"browser",define:{CXL_DEBUG:"false"},...e}).then(()=>t.complete())})}function U(e=C){let t=Kt(e,"package.json");if(!Yt(t))throw new Error(`"${t}" not found`);let r=JSON.parse(Le(t,"utf8"));return Oe(["name","version","description"],r,t),r.private||Oe(["license"],r,t),r}function er(e,t){return R({path:"package.json",source:Buffer.from(JSON.stringify({name:e.name,version:e.version,description:e.description,private:e.private,license:e.license,files:e.files||["*.js","*.d.ts","*.css","LICENSE.md","*.md"],main:t??e.main??"index.js",exports:e.exports,browser:e.browser,homepage:e.homepage,bugs:e.bugs,bin:e.bin,sideEffects:e.sideEffects,repository:e.repository,dependencies:e.dependencies,peerDependencies:e.peerDependencies,bundledDependencies:e.bundledDependencies,type:e.type},null,2))})}function tr(e){if(e==="UNLICENSED"||e==="SEE LICENSE IN LICENSE.md")return O;let t=Zt[e];if(!t)throw new Error(`Invalid license: "${e}"`);return S(Ht(import.meta.dirname,t),"LICENSE")}function rr(e,t){return`https://npmjs.com/package/${e}/v/${t}`}function nr(e){try{return Le(e,"utf8")}catch{return""}}function Ge(){return P(()=>{let e=U(C),t=nr("USAGE.md"),r=encodeURIComponent(e.name);return R({path:"README.md",source:Buffer.from(`# ${e.name}
|
|
7
|
+
|
|
8
|
+
[](https://badge.fury.io/js/${r})
|
|
9
|
+
|
|
10
|
+
${e.description}
|
|
11
|
+
|
|
12
|
+
## Project Details
|
|
13
|
+
|
|
14
|
+
- Branch Version: [${e.version}](${rr(e.name,e.version)})
|
|
15
|
+
- License: ${e.license}
|
|
16
|
+
- Documentation: [Link](${e.homepage})
|
|
17
|
+
- Report Issues: [Github](${e.bugs})
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
npm install ${e.name}
|
|
22
|
+
|
|
23
|
+
${t}`)})})}function ie(e){return P(()=>{let t=U(),r=t.license,n=[er(t,e)];return r&&n.push(tr(r)),ge(...n)})}var pr=x.green("build"),b=Fe.bind(null,pr),Je=fr(import.meta.dirname);function dr(e){return(e/1e3).toFixed(2)+"kb"}function mr(e){let t=Number(e)/1e9,r=t.toFixed(4)+"s";return t>.1?t>.5?x.red(r):x.yellow(r):r}function q(e){return Je(Je.resolve(e,{paths:[process.cwd(),import.meta.dirname]}))}async function Ve(...e){if(!e)throw new Error("Invalid configuration");C!==process.cwd()&&(process.chdir(C),b(`chdir "${C}"`));let t=U();b(`${t.name} ${t.version}`);let r=[void 0,...process.argv];try{for(let n of r)for(let o of e)o.target===n&&await new ce(b,o).build()}catch(n){console.error(n),process.exit(1)}}function V(e,t){return new u(r=>{b(`sh ${e}`),Ne(d(e,t)).then(n=>{b(`sh ${e}`,mr(n.time)),n.result&&console.log(n.result),r.complete()},n=>{r.error(n)})})}function Ie(e,t={}){return new u(r=>{let n=ur(e,[],{shell:!0,...t}),o,s;n.stdout?.on("data",i=>o=o?Buffer.concat([o,Buffer.from(i)]):Buffer.from(i)),n.stderr?.on("data",i=>s=s?Buffer.concat([s,Buffer.from(i)]):Buffer.from(i)),n.on("close",i=>{i?r.error(s||o):(r.next(o),r.complete())})})}var ce=class{log;config;outputDir;constructor(t,r){this.log=t,this.config=r,this.outputDir=r.outputDir||"."}async build(){try{let t=this.config.target||"";t&&this.log(`target ${t}`),Me(`mkdir -p ${this.outputDir}`),await Promise.all(this.config.tasks.map(r=>this.runTask(r)))}catch(t){throw console.log("BUILD: ",t),"Build finished with errors"}}async runTask(t){await t.tap(r=>{let n=ir(this.outputDir,r.path),o=r.source,s=or(n);cr(s)||Me(`mkdir -p ${s}`),lr(n,o),r.mtime&&ar(n,r.mtime,r.mtime);let i=sr(process.cwd(),n);this.log(`${i} ${dr((r.source||"").length)}`)})}};import{relative as gr,join as hr}from"path";function wr(e){let t=[],r=!1;if(e.forEach(n=>{let o=n.errorCount,s=gr(process.cwd(),n.filePath);b(`eslint ${s}`),o&&(r=!0,n.messages.forEach(i=>console.error(`${s}#${i.line}:${i.column}: ${i.message} (${i.ruleId})`)))}),r)throw new Error("eslint errors found.");return t}function Ue(e){return new u(t=>{(async()=>{let{ESLint:r}=q("eslint");b(`eslint ${r.version}`),new r({cache:!0,cwd:process.cwd(),overrideConfigFile:hr(import.meta.dirname,"eslint-config.js"),...e}).lintFiles(["**/*.ts?(x)"]).then(wr).then(()=>t.complete(),o=>t.error(o))})()})}import{relative as xr}from"path";var w=q("typescript"),N=w.sys,yr={useCaseSensitiveFileNames:!0,readDirectory:N.readDirectory,getCurrentDirectory:N.getCurrentDirectory,fileExists:N.fileExists,readFile:N.readFile,onUnRecoverableConfigFileDiagnostic(e){throw e}},br={getCurrentDirectory:N.getCurrentDirectory,getNewLine:()=>`
|
|
24
|
+
`,getCanonicalFileName:e=>e},Qn=w.version;function $r(e){return[...e.getConfigFileParsingDiagnostics(),...e.getOptionsDiagnostics(),...e.getGlobalDiagnostics(),...e.getDeclarationDiagnostics()]}function qe(e,t=br){throw console.error(w.formatDiagnosticsWithColorAndContext(e,t)),new Error("Typescript compilation failed")}function vr(e="tsconfig.json",t={module:w.ModuleKind.CommonJS}){let r=w.createSolutionBuilderHost(N),n=Sr(e);n.errors?.length&&qe(n.errors);let o=n.options.outDir;if(!o)throw new Error(`No outDir field set in ${e}`);let s=w.createSolutionBuilder(r,[e],t);return{outputDir:o,builder:s,options:n}}function Er(e="tsconfig.json",t,r={module:w.ModuleKind.CommonJS}){let{outputDir:n,builder:o}=vr(e,r),s,i="";function c(a,l){i&&a.startsWith(i)?(a=xr(n,a),t.next({path:a,source:Buffer.from(l)})):console.warn(`File "${a}" is outside of outDir. Ignoring.`)}for(;s=o.getNextInvalidatedProject();){if(s.kind===w.InvalidatedProjectKind.Build){let l=s.getProgram();if(i=s.getCompilerOptions().outDir??"",l){let p=$r(l);p.length&&qe(p)}}if(s.done(void 0,c)!==w.ExitStatus.Success)throw`${s.project}: Typescript compilation failed`}}function _e(e="tsconfig.json",t){return new u(r=>{Er(e,r,t),r.complete()})}function Sr(e){let t;try{t=w.getParsedCommandLineOfConfigFile(e,{},yr)}catch(r){if(r instanceof Error)throw r;let n=r?.message||r?.messageText||"Unknown Error";throw new Error(n)}if(!t)throw console.log(process.cwd()),new Error(`Could not parse config file "${e}"`);return t}import*as F from"path";import{promises as m}from"fs";import*as ze from"child_process";var kr="https://github.com/cxlio/cxl/issues",We=F.resolve("."),Dr=["name","version","description","license","homepage","bugs"],Pr=["build","test"],jr=["GPL-3.0","GPL-3.0-only","Apache-2.0","SEE LICENSE IN LICENSE.md"];async function Cr({projectPath:e,rootPkg:t}){let r=`${e}/package.json`,n=await h(r),o=JSON.stringify(n,null," ");for(let i in n.dependencies){let c=t.devDependencies?.[i]||t.dependencies?.[i];c&&n.dependencies[i]!==c&&(n.dependencies[i]=c)}let s=JSON.stringify(n,null," ");o!==s&&await m.writeFile(r,s)}async function Nr({projectPath:e,name:t}){let r=`${e}/package.json`,n=await h(r),o=await h(`${e}/tsconfig.json`,!1),s=JSON.stringify(n,null," ");o||(o={extends:"../tsconfig.json",compilerOptions:{outDir:`../dist/${t}`},files:[],references:[]},await m.writeFile(`${e}/tsconfig.json`,JSON.stringify(o,null," ")));let i=JSON.stringify(n,null," ");s!==i&&await m.writeFile(r,i)}async function Fr({projectPath:e,name:t}){let r=`${e}/tsconfig.test.json`,n=`${e}/test.ts`,o=!1;await G(r)||await m.writeFile(r,`{
|
|
25
|
+
"extends": "./tsconfig.json",
|
|
26
|
+
"include": ["test.ts"],
|
|
27
|
+
"references": [{ "path": "." }, { "path": "../spec" }]
|
|
28
|
+
}
|
|
29
|
+
`);let s=await h(`${e}/tsconfig.test.json`,null)||{};(!s.extends||s.extends!=="./tsconfig.json")&&(s.extends="./tsconfig.json",o=!0),s.compilerOptions&&(delete s.compilerOptions,o=!0),o&&await m.writeFile(`${e}/tsconfig.test.json`,JSON.stringify(s,null," ")),await G(n)||await m.writeFile(n,`import { spec } from '@cxl/spec';
|
|
30
|
+
import { } from './index.js';
|
|
31
|
+
|
|
32
|
+
export default spec('${t}', s => {
|
|
33
|
+
s.test('should load', a => {
|
|
34
|
+
a.ok(get);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
`)}function G(e){return m.stat(e).catch(()=>!1)}function f(e,t){return{valid:e,message:t}}async function Br({projectPath:e,name:t,rootPkg:r}){let n=`${e}/package.json`,o=await h(n),s=JSON.stringify(o,null," "),i=r.devDependencies?.["@cxl/build"]?"cxl-build":"node ../dist/build",c="npm run build test",a=o.exports?.["."]??"index.bundle.js";o.scripts||(o.scripts={}),o.scripts.test||(o.scripts.test=c),o.scripts.build||(o.scripts.build=i),o.homepage||(o.homepage=`${r.homepage}/${t}`),o.license||(o.license="GPL-3.0"),(!o.bugs||o.bugs!==r.bugs)&&(o.bugs=r.bugs||kr),!o.browser&&o.devDependencies&&delete o.devDependencies,o.browser&&o.dependencies&&delete o.dependencies,o.peerDependencies&&delete o.peerDependencies,o.browser&&(o.browser=a),!o.repository&&r.repository&&(typeof r.repository=="string"&&(r.repository={type:"git",url:r.repository}),o.repository={...r.repository,directory:t}),o.scripts.test!==c&&(o.scripts.test=c);let l=JSON.stringify(o,null," ");s!==l&&await m.writeFile(n,l)}async function Ir({pkg:e,name:t,rootPkg:r}){let n=Dr.map(i=>f(i in e,`Field "${i}" required in package.json`)),o=e.exports?.["."]??"index.bundle.js";if(e.scripts){let i=e.scripts;n.push(...Pr.map(c=>f(c in i,`Script "${c}" required in package.json`)))}else n.push(f("scripts"in e,'Field "scripts" required in package.json'));return n.push(f(jr.includes(e.license),`"${e.license}" is not a valid license.`),f(!!e.browser||!e.devDependencies,"Package should not have devDependencies."),f(!e.browser||!e.dependencies,"Browser package should only have devDependencies."),f(!e.peerDependencies,"Package should not have peerDependencies."),f(!e.browser||e.browser===o,`Package "browser" property should be "${o}"`),f(e.bugs===r.bugs,`Package "bugs" property must match root package "${r.bugs}"`),f(e?.scripts?.test==="npm run build test","Valid test script in package.json"),f(!!e.repository,'Package "repository" field must be set'),f(typeof e.repository!="string",'"repository" must be an object')),{id:"package",project:t,fix:Br,rules:n}}async function Tr({projectPath:e}){let t=await h(`${e}/tsconfig.test.json`);return{id:"test",fix:Fr,project:e,rules:[f(!!await G(`${e}/tsconfig.test.json`),'Missing "tsconfig.test.json" file.'),f(t?.extends==="./tsconfig.json",'tsconfig.test.json extends should be "./tsconfig.json"'),f(!!(await G(`${e}/test.ts`)||await G(`${e}/test.tsx`)),'Missing "test.ts" file.'),f(!t.compilerOptions,"tsconfig.test.json should not have compilerOptions")]}}async function Rr({name:e,rootPkg:t,pkg:r}){let n=[];for(let o in r.dependencies){let s=r.dependencies[o],i=t.devDependencies?.[o]||t.dependencies?.[o];n.push(f(!!(o.startsWith(t.name)||i),`Dependency "${o}" must be included in root package.json`),f(s!=="*",`Dependency "${o}" must be a valid version. pkg:${s}`),f(o.startsWith(t.name)||i===s,`Conflicting versions "${o}". root: ${i}, dep: ${s}`))}return{id:"dependencies",project:e,fix:Cr,rules:n}}async function Or({projectPath:e,name:t}){let r=await h(`${e}/tsconfig.json`,null),n=[f(!!r,"tsconfig.json should be present"),f(!!r?.compilerOptions,"tsconfig.json should have compilerOptions"),f(r?.compilerOptions?.outDir===`../dist/${t}`,"tsconfig.json should have a valid outDir compiler option")];return{id:"tsconfig",project:t,fix:Nr,rules:n}}var Lr=/(.+):(.+)/g;async function Ar({name:e}){let r=ze.spawnSync("git",["grep",`"from '\\.\\.\\/"`,e],{encoding:"utf8"}).stdout.trim(),n=[],o;for(;o=Lr.exec(r);){let[,s,i]=o,c=i.replace(/'\.\.\/([^/]+)\/index\.js/,"'@cxl/$1");if(c!==i){n.push({file:s,line:i,newLine:c});let a=await m.readFile(s,"utf8");await m.writeFile(s,a.replace(i,c))}}return{id:"imports",project:e,rules:[f(n.length===0,"Should not have local imports")],async fix(){for(let s of n){let i=await m.readFile(s.file,"utf8");await m.writeFile(s.file,i.replace(s.line,s.newLine))}}}}var Gr=[Ir,Tr,Rr,Or,Ar];async function Mr(e){let t=We,r=await m.stat(t),n=F.basename(t);if(!r.isDirectory())return[];let o=await h(F.join(t,"package.json"),!1);if(!o)return[];let s={projectPath:t,name:n,pkg:o,rootPkg:e,baseDir:We},i=(await Promise.all(Gr.map(c=>c(s)))).flat();return i.forEach(c=>c.data=s),i}async function Ye(){function e(s,i){console.error(`${s}: ${i}`)}let t=await h("../package.json"),r=await Mr(t),n=!1,o=[];for(let s of r){for(let i of s.rules)i.valid||(s.hasErrors=n=!0,e(s.data?.name||"root",i.message));if(s.hasErrors&&s.fix&&s.data){let{data:i,fix:c}=s;o.push(()=>(console.log(`${s.data?.name}: Attempting fix for "${s.id}"`),c(i)))}}for(let s of o)await s();if(n)throw new Error("Errors detected, check logs for details.")}import{readFile as Jr}from"fs/promises";async function He(e){return(await d("git rev-parse --abbrev-ref HEAD",{cwd:e})).trim()}async function Ke(e){return(await d("git remote show origin",{cwd:e})).match(/HEAD branch:\s+(\S+)/)?.[1]}import{resolve as Vr}from"path";async function Ur(e){return JSON.parse(await Jr(e,"utf8"))}async function qr(e,t){let r=Vr(t);try{await d("npm install --production",{cwd:r}),await d("npm test",{cwd:e})}finally{await d(`rm -rf ${r}/node_modules ${r}/package-lock.json`)}}async function Xe(e,t){let r=await He(process.cwd()),n=await Ke(process.cwd());if(r!==n)throw`Active branch "${r}" is not main branch`;let o=await Ur(`${e}/package.json`),s=o.name.split("/")[1],i=await _r(o.name);if(i.versions.includes(o.version))console.log(`Package "${o.name}" version "${o.version}" already published. Skipping.`);else{console.log(`Building ${o.name} ${o.version}`),await d(`npm run build package --prefix ${e}`),await qr(e,t);let a=o.version.includes("beta")?"beta":o.version.includes("alpha")?"alpha":"latest",l=a==="alpha"?i["dist-tags"].alpha:void 0;if(console.log(await d(`npm publish --access=public --tag ${a}`,{cwd:t})),a==="beta"||a==="alpha"){let p=`${o.version.split(".")[0]}-${a}`;console.log(await d(`npm dist-tag add ${o.name}@${o.version} ${p}`))}if(l)try{console.log(await d(`npm unpublish ${o.name}@${l}`))}catch(p){console.error(`Removing old version ${o.name}@${l} failed.`),console.error(p)}}let c=`${s}/${o.version}`;(await d(`git tag -l ${c}`)).trim()||(console.log(`Creating tag "${c}"`),await d(`git tag ${c} && git push origin ${c}`))}async function _r(e){return JSON.parse((await d(`npm show ${e} --json`)).trim())}var zr;function Qe(e,t={}){for(let r in e)t[r]=`/${r}`;return t}function Ze(e,t){let r={};return e.devDependencies&&Qe(e.devDependencies,r),t.dependencies&&Qe(t.dependencies,r),r}function Yr(e,t){let r=Ze(e,t);return JSON.stringify({imports:r})}function Hr(e,t){let r=Ze(e,t);for(let n in r)r[`${n}/`]=`../../node_modules${r[n]}/`;return r["@cxl/spec"]="../../node_modules/@cxl/spec/index.bundle.js",JSON.stringify({imports:r})}function Kr(e,t,r,n){return Buffer.from(`<!DOCTYPE html>
|
|
38
|
+
<title>${t} Test Suite</title>
|
|
39
|
+
<script type="importmap">${n}</script>
|
|
40
|
+
<script type="module">
|
|
41
|
+
import suite from '${r}';
|
|
42
|
+
${zr??=W(_(import.meta.dirname,"spec-browser.js"),"utf8")}
|
|
43
|
+
browserRunner.run([suite], '../../${e}/spec');
|
|
44
|
+
</script>`)}function Eo(...e){let t=process.cwd(),n=JSON.parse(W(t+"/tsconfig.json","utf8"))?.compilerOptions?.outDir,o=Wr(n),s=_(n,"package"),i=JSON.parse(W("package.json","utf8")),c=JSON.parse(W("../package.json","utf8")),a=!!i.browser,l=i.browser==="./index.bundle.js"&&i.exports,p=i.browser??i.exports?.["."]??"./index.bundle.js",k=[...Object.keys(i.dependencies??{}),...Object.keys(i.peerDependencies??{})],B=[{out:"index.bundle",in:_(n,"index.js")}],M=i.exports?Object.values(i.exports).flatMap(g=>g?[_(n,g)]:[]):B;return Ve({outputDir:n,tasks:[S("test-screenshot.html","test-screenshot.html").catchError(()=>O),S("test.html","test.html").catchError(()=>R({path:"test.html",source:Kr(o,i.name,"./test.js",Hr(c,i))})),_e("tsconfig.test.json"),ie("index.js")]},{target:"test",outputDir:n,tasks:[J(async()=>{try{process.chdir(n);let g=await ke({node:!a,mjs:!0,vfsRoot:"../..",entryFile:"./test.js",importmap:a?Yr(c,i):void 0,sources:new Map,log:console.log.bind(console)});oe(g)}finally{process.chdir(t)}}).ignoreElements()]},{target:"audit",outputDir:n,tasks:[J(Ye).ignoreElements()]},{target:"docs",outputDir:`../docs/${o}`,tasks:[E(g=>{import("./render-F5OGOROK.js").then(({buildDocs:D})=>D({$:[],clean:!0,summary:!0,markdown:!0,cxlExtensions:!0,debug:!0,outputDir:`../docs/${o}`},ae=>{g.next({path:ae.name,source:Buffer.from(ae.content)})}).then(()=>g.complete()))})]},{target:"package",outputDir:".",tasks:[Ge(),Ue(),V(`rm -rf ${s}`)]},{target:"package",outputDir:s,tasks:[S("README.md","README.md"),S("LICENSE.md","LICENSE.md").catchError(()=>O),ie(p),Re(n,s,"*.d.ts"),se({entryPoints:M,platform:a?"browser":"node",outdir:s,external:k}),...l?[se({entryPoints:B,platform:"browser",outdir:s,external:k})]:[]]},{target:"publish",outputDir:n,tasks:[J(async()=>{await Xe(".",s)}).ignoreElements()]},...e)}export{se as a,Ge as b,ie as c,Ve as d,V as e,Ie as f,S as g,Dn as h,Pn as i,jn as j,Re as k,Cn as l,Eo as m};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{existsSync as Ae}from"fs";import{dirname as q,join as Ne,resolve as Le}from"path";import{readFile as Ie,stat as Re,mkdir as $e}from"fs/promises";import{join as zt,resolve as je}from"path";import{spawn as Oe}from"child_process";import{relative as ae,resolve as Ge}from"path";import{createRequire as Je}from"module";var z={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]},Yt=Object.keys(z).reduce((e,t)=>{let n=z[t],i="\x1B["+n[0]+"m",a="\x1B["+n[1]+"m";return e[t]=s=>i+s+a,e},{}),re='"(?:[^"\\\\]|\\\\.)*"',Me="-(\\w\\w+)",ie=`\\s*=?\\s*(${re}|[^-][^\\s]*)?`,Be=`-(\\w)${ie}`,Ue=`--(\\w+)${ie}`,_t=new RegExp(`\\s*(?:${Me}|${Be}|${Ue}|(${re}|[^\\s]+))`,"g");async function O(e){await Re(e).catch(()=>O(je(e,"..")).then(()=>$e(e)))}async function Q(e,t){try{return JSON.parse(await Ie(e,"utf8"))}catch(n){if(t!==void 0)return t;throw n}}function Ke(e,t={}){return new Promise((n,i)=>{let a=Oe(e,[],{shell:!0,...t}),s="";a.stdout?.on("data",c=>s+=c?.toString()||""),a.stderr?.on("data",c=>s+=c?.toString()||""),a.on("exit",c=>{c!==0?i(s):n(s)})})}var o;(function(e){e[e.Unknown=0]="Unknown",e[e.Variable=1]="Variable",e[e.TypeAlias=2]="TypeAlias",e[e.TypeParameter=3]="TypeParameter",e[e.Interface=4]="Interface",e[e.TypeUnion=5]="TypeUnion",e[e.Reference=6]="Reference",e[e.Module=7]="Module",e[e.Class=8]="Class",e[e.Parameter=9]="Parameter",e[e.Property=10]="Property",e[e.Method=11]="Method",e[e.Getter=12]="Getter",e[e.Setter=13]="Setter",e[e.Constructor=14]="Constructor",e[e.Array=15]="Array",e[e.Function=16]="Function",e[e.FunctionType=17]="FunctionType",e[e.ConditionalType=18]="ConditionalType",e[e.Parenthesized=19]="Parenthesized",e[e.Infer=20]="Infer",e[e.IndexedType=21]="IndexedType",e[e.Enum=22]="Enum",e[e.Literal=23]="Literal",e[e.IndexSignature=24]="IndexSignature",e[e.Export=25]="Export",e[e.Keyof=26]="Keyof",e[e.Typeof=27]="Typeof",e[e.ConstructorType=28]="ConstructorType",e[e.Tuple=29]="Tuple",e[e.ThisType=30]="ThisType",e[e.Constant=31]="Constant",e[e.BaseType=32]="BaseType",e[e.ClassType=33]="ClassType",e[e.ObjectType=34]="ObjectType",e[e.Component=35]="Component",e[e.Attribute=36]="Attribute",e[e.Namespace=37]="Namespace",e[e.CallSignature=38]="CallSignature",e[e.ConstructSignature=39]="ConstructSignature",e[e.MappedType=40]="MappedType",e[e.TypeIntersection=41]="TypeIntersection",e[e.ReadonlyKeyword=42]="ReadonlyKeyword",e[e.UnknownType=43]="UnknownType",e[e.Event=44]="Event",e[e.Spread=45]="Spread",e[e.ImportType=46]="ImportType",e[e.Symbol=47]="Symbol"})(o||(o={}));var p;(function(e){e[e.None=0]="None",e[e.Export=1]="Export",e[e.Ambient=2]="Ambient",e[e.Public=4]="Public",e[e.Private=8]="Private",e[e.Protected=16]="Protected",e[e.Static=32]="Static",e[e.Readonly=64]="Readonly",e[e.Abstract=128]="Abstract",e[e.Async=256]="Async",e[e.Default=512]="Default",e[e.Deprecated=8192]="Deprecated",e[e.Overload=16384]="Overload",e[e.External=32768]="External",e[e.DefaultLibrary=65536]="DefaultLibrary",e[e.DeclarationMerge=131072]="DeclarationMerge",e[e.Rest=262144]="Rest",e[e.Optional=524288]="Optional",e[e.Internal=1048576]="Internal"})(p||(p={}));var oe=Je(import.meta.dirname),Ve=oe.resolve("typescript",{paths:[".",import.meta.dirname]}),l=oe(Ve),{getParsedCommandLineOfConfigFile:He,NodeFlags:Y,sys:A}=l,r=l.SyntaxKind,d=l.TypeFlags,le={[r.Unknown]:o.Unknown,[r.VariableDeclaration]:o.Variable,[r.TypeAliasDeclaration]:o.TypeAlias,[r.TypeParameter]:o.TypeParameter,[r.InterfaceDeclaration]:o.Interface,[r.UnionType]:o.TypeUnion,[r.TypeReference]:o.Reference,[r.SourceFile]:o.Module,[r.ClassDeclaration]:o.Class,[r.Parameter]:o.Parameter,[r.PropertyDeclaration]:o.Property,[r.MethodDeclaration]:o.Method,[r.GetAccessor]:o.Getter,[r.SetAccessor]:o.Setter,[r.Constructor]:o.Constructor,[r.ArrayType]:o.Array,[r.FunctionDeclaration]:o.Function,[r.FunctionType]:o.FunctionType,[r.ConditionalType]:o.ConditionalType,[r.ParenthesizedType]:o.Parenthesized,[r.InferType]:o.Infer,[r.IndexedAccessType]:o.IndexedType,[r.EnumDeclaration]:o.Enum,[r.LiteralType]:o.Literal,[r.TemplateLiteralType]:o.Literal,[r.IndexSignature]:o.IndexSignature,[r.ExportSpecifier]:o.Export,[r.KeyOfKeyword]:o.Keyof,[r.TypeQuery]:o.Typeof,[r.ConstructorType]:o.ConstructorType,[r.TupleType]:o.Tuple,[r.ThisType]:o.ThisType,[r.ModuleDeclaration]:o.Namespace,[r.CallSignature]:o.CallSignature,[r.ConstructSignature]:o.ConstructSignature,[r.MappedType]:o.MappedType,[r.IntersectionType]:o.TypeIntersection,[r.ReadonlyKeyword]:o.ReadonlyKeyword,[r.UnknownKeyword]:o.UnknownType,[r.SpreadAssignment]:o.Spread,[r.ImportType]:o.ImportType,[r.SymbolKeyword]:o.Symbol},se={exportsOnly:!0,rootDir:void 0,cxlExtensions:!1},ce=v("number"),pe=v("string"),ue=v("boolean"),fe=v("undefined"),de=v("null"),ye=v("void"),me=v("any"),We=v("unknown"),qe=v("BigInt"),ge=v("never"),k=Symbol("dtsNode"),ze=l.createPrinter(),he,g,C,M,u,Qe=1,P,I,h,E,B,U={useCaseSensitiveFileNames:!0,readDirectory:A.readDirectory,getCurrentDirectory:A.getCurrentDirectory,getNewLine:()=>`
|
|
2
|
+
`,fileExists:A.fileExists,getCanonicalFileName:e=>e,readFile:A.readFile,onUnRecoverableConfigFileDiagnostic(e){let t=l.formatDiagnosticsWithColorAndContext([e],U);throw new Error(t)}};function v(e){return{name:e,kind:o.BaseType,flags:0}}function Te(e,t){let n;try{n=He(e,{},U)}catch(i){if(i instanceof Error)throw i;let a=typeof i=="string"?i:String(i);throw new Error(a)}if(!n)throw new Error(`Could not parse config file "${e}"`);return n}function Ye(e){switch(e.kind){case r.BindingElement:return e.parent.parent.parent.flags&Y.Const?o.Constant:o.Variable;case r.VariableDeclaration:return e.parent.flags&Y.Const?o.Constant:o.Variable;case r.TypeLiteral:case r.ObjectLiteralExpression:return o.ObjectType;case r.PropertySignature:case r.PropertyAssignment:case r.EnumMember:return o.Property}return le[e.kind]||o.Unknown}function K(e,t){return Qe++}function _e(e){let t=h.packageRoot||process.cwd(),n=e.getSourceFile(),i=n?{name:ae(t,n.fileName),index:e.pos,tsconfig:g.getCompilerOptions().configFilePath}:void 0;return i&&Object.defineProperty(i,"sourceFile",{value:n,enumerable:!1}),i}function G(e){return l.isSourceFile(e)?W(e.fileName):(e.name?e=e.name:e.typeName&&(e=e.typeName),e.escapedText!==void 0?e.escapedText:e.pos!==-1&&l.isStringLiteral(e)?e.getText():l.isTemplateLiteralTypeNode(e)||l.isLiteralTypeNode(e)||l.isLiteralExpression(e)?ze.printNode(l.EmitHint.Unspecified,e,e.getSourceFile()):e.text?e.text:l.isComputedPropertyName(e)||l.isQualifiedName(e)?e.pos===-1?e.text||"":e.getText():e.moduleName||"")}function y(e,t){let n=e[k]||{};n.source??=_e(e),n.kind=t?.kind??n.kind??Ye(e),n.name||=t?.name||G(e),n.flags??=nt(e);let i=lt(e,n);return i&&(n.docs=i),t&&Object.assign(n,t),e[k]=n}function J(e,t){let n=t[k];if(!n){let i=t.getSourceFile();if(!g.isSourceFileDefaultLibrary(i)&&!g.isSourceFileFromExternalLibrary(i)&&i.isDeclarationFile&&e){let a=H(e),s=I[a];if(s?.source)return s}return y(t)}return n.id??=K(t),n}function Xe(e){return e.kind===r.PropertyDeclaration||e.kind===r.MethodDeclaration||e.kind===r.GetAccessor||e.kind===r.SetAccessor||e.kind===r.PropertySignature||e.kind===r.MethodSignature}function f(e){return(Ot[e.kind]||y)(e)}function Ze(e){return e.getText()}function et(e,t){let n=e;if(e.kind===r.ModuleDeclaration)return!1;do{if(n.$$internal)return!0;if(n.$$internal===!1)continue;let i=l.getLeadingCommentRanges(t,n.pos);if(i){for(let a of i)if(t.substring(a.pos,a.end).indexOf("@internal")!==-1)return n.$$internal=!0}}while(n=n.parent);return e.$$internal=!1}function tt(e,t){let n=l.ModifierFlags,i=e.getSourceFile()?.isDeclarationFile,a=0;return(t&n.Export||i||e.kind===r.NamespaceExport)&&(a|=p.Export),t&n.Ambient&&(a|=p.Ambient),t&n.Public&&(a|=p.Public),t&n.Private&&(a|=p.Private),t&n.Protected&&(a|=p.Protected),t&n.Static&&(a|=p.Static),t&n.Readonly&&(a|=p.Readonly),t&n.Abstract&&(a|=p.Abstract),t&n.Async&&(a|=p.Async),t&n.Default&&(a|=p.Default),t&n.Deprecated&&(a|=p.Deprecated),Xe(e)&&(l.isPrivateIdentifier(e.name)?a|=p.Private:a&(p.Private|p.Protected)||(a|=p.Public)),a}function nt(e){let t=0;e.questionToken&&(t|=p.Optional);let n=l.isSourceFile(e)?e:e.getSourceFile();return n&&(et(e,n.getFullText())&&(t|=p.Internal),g.isSourceFileDefaultLibrary(n)&&(t|=p.DefaultLibrary),g.isSourceFileFromExternalLibrary(n)&&(t|=p.External)),t}function V(e){if(e.$$resolvedType)return;let t=u.getWidenedType(e);if(t===e)try{let n=u.typeToTypeNode(t,void 0,l.NodeBuilderFlags.NoTypeReduction|l.NodeBuilderFlags.InTypeAlias|l.NodeBuilderFlags.NoTruncation);return n&&(n.$$resolvedType=!0),n?f(n):void 0}catch(n){console.error(n);return}else t.$$resolvedType=!0;return T(t)}var rt=/<!--(.*?)-->/g;function _(e){return e.replace(rt,"")}function X(e){if(e)return typeof e=="string"?_(e):e.map(t=>t.kind===r.JSDocLink?{tag:"link",value:`${t.name?.getText()||""}${t.text}`}:{value:_(t.text)})}var it=/^\s*\*\s/gm;function at(e){return e.getText().replace(it,"")}function ot(e,t){let n=`
|
|
3
|
+
${at(t)}`;if(e.length>0){let i=e[e.length-1].value||"";typeof i=="string"?e[e.length-1].value=i+n:i.push({value:n})}else e.push({value:n})}function lt(e,t){let n=e.jsDoc,i=[],a={content:i};return n?.forEach(s=>{let c=X(s.comment);c&&i.push({value:c})}),l.getJSDocTags(e).forEach(s=>{let c=s.tagName.escapedText==="description"?void 0:s.tagName.escapedText,b=s.name?.getText(),w=s.comment?X(s.comment):b;if(h.cxlExtensions&&c==="tagName"){a.tagName=String(w);return}if(s.comment&&c&&!h?.customJsDocTags?.includes(c)&&c!==c.toLowerCase()&&i.length>0){ot(i,s);return}c==="deprecated"&&(t.flags|=p.Deprecated),c==="see"&&s.comment==="*"&&(w=b),c==="beta"&&(a.beta=!0),c==="alpha"&&(a.alpha=!0),h.cxlExtensions&&(c==="attribute"?t.kind=o.Attribute:c==="event"&&(t.kind=o.Event)),w&&!(c==="param"&&e.kind!==r.Parameter)&&i.push({tag:c==="desc"||c==="description"?void 0:c,value:w})}),i.length?a:void 0}function D(e){let t=y(e);t.id===void 0&&(t.id=K(e,t)),t.flags|=tt(e,l.getCombinedModifierFlags(e));let n=t.id,i=e.typeParameters;return i&&(t.typeParameters=i.map(f)),l.isEnumMember(e)?t.value=JSON.stringify(u.getConstantValue(e)):e.initializer&&(t.value=Ze(e.initializer)),n&&(he[n]=t),t}function st(e){let t=D(e);return e.default&&e.getSourceFile()&&(t.value=e.default.getText()),e.constraint&&(t.children=[f(e.constraint)]),t}function ct(e){return{name:e.name,kind:o.Unknown,flags:0}}function pt(e){let t=e.valueDeclaration;if(!t)return ct(e);let n=m(t);return n.name||(n.name=t.name.getText()),n.flags&(p.Private|p.Public|p.Protected)&&(n.kind=o.Property),t.dotDotDotToken&&(n.flags=n.flags|p.Rest),t.questionToken&&(n.flags=n.flags|p.Optional),n}function N(e,t){let n=e.declarations?.[0]||e.valueDeclaration,i=e.flags&l.SymbolFlags.Namespace||n?.kind===r.EnumMember?Se(e):e.getName();return n?{name:i,flags:0,kind:o.Reference,type:J(e,n),typeParameters:t&&t.length?t.map(T):void 0}:{name:i,flags:0,kind:o.Reference,typeParameters:t&&t.length?t.map(T):void 0}}function ut(e){return e.flags&d.Enum||e.flags&d.EnumLiteral||e.flags&d.UniqueESSymbol||e.isClassOrInterface()||e.isTypeParameter()||e.objectFlags&l.ObjectFlags.Reference}function ft(e){return{name:"",kind:o.IndexedType,flags:0,children:[T(e.objectType),T(e.indexType)]}}function R(e){return e&&(e.declarations?.[0]||e.valueDeclaration)}function be(e){let t=R(e),n=t?f(t):{name:e.name,kind:o.Unknown,flags:0};return n.kind!==o.Namespace&&(n.name=e.name),n}function dt(e){return{name:u.typeToString(e),kind:o.Keyof,type:T(e.type),resolvedType:V(e),flags:0}}function yt(e,t){return{name:u.typeToString(e),kind:o.Literal,type:t!==e?T(t):void 0,flags:0}}function Z(e){let t=u.typeToTypeNode(e,void 0,l.NodeBuilderFlags.InObjectTypeLiteral|l.NodeBuilderFlags.NoTruncation);return t?f(t):{name:u.typeToString(e),kind:o.ObjectType,flags:0}}function mt(e){return u.isArrayType(e)}function T(e){if(e.aliasSymbol)return N(e.aliasSymbol,e.aliasTypeArguments);if(e.flags&d.Any)return me;if(e.flags&d.Unknown)return We;if(e.flags&d.Void)return ye;if(e.flags&d.Boolean)return ue;if(e.flags&d.BigInt)return qe;if(e.flags&d.Null)return de;if(e.flags&d.Number)return ce;if(e.flags&d.String)return pe;if(e.flags&d.Undefined)return fe;if(e.flags&d.Never)return ge;if(e.flags&d.Index)return dt(e);if(e.flags&d.IndexedAccess)return ft(e);if(mt(e))return Z(e);if(e.symbol?.flags&l.SymbolFlags.Namespace){let t=N(e.symbol);return t.kind=o.ImportType,t}if(ut(e)&&e.symbol)return N(e.symbol,u.getTypeArguments(e));if(e.flags&d.Literal||e.flags&d.TemplateLiteral){let t=u.getBaseTypeOfLiteralType(e);return e.isStringLiteral()||e.isNumberLiteral()||e.isLiteral()||e.flags&d.TemplateLiteral?yt(e,t):T(t)}return e.isUnionOrIntersection()?{name:"",flags:0,kind:e.isUnion()?o.TypeUnion:o.TypeIntersection,children:e.types.map(T)}:e.flags&d.Object?Z(e):e.symbol?be(e.symbol):{name:u.typeToString(e),kind:o.Unknown,flags:0}}function S(e){let t=D(e),n=u.getSignatureFromDeclaration(e);e.kind===r.ArrowFunction||e.kind===r.FunctionExpression?t.kind=o.Function:e.kind===r.MethodSignature&&(t.kind=o.Method),e.type&&(t.type=f(e.type)),e.typeParameters&&(t.typeParameters=e.typeParameters.map(f)),t.parameters=n?n.getParameters().map(pt):e.parameters.map(f);let i=u.getTypeAtLocation(e);if(u.getSignaturesOfType(i,l.SignatureKind.Call)?.length>1&&!u.isImplementationOfOverload(e)&&(t.flags=t.flags|p.Overload),n&&!t.type){let a=n.getReturnType();t.type=a&&T(a)}return t}function gt(e){let t=y(e,{name:"Array"});return t.type=f(e.elementType),t}function xe(e,t){if(!l.canHaveDecorators(e))return;let n=l.getDecorators(e);return n&&n.find(i=>l.isCallExpression(i.expression)&&l.isIdentifier(i.expression.expression)&&i.expression.expression.escapedText.endsWith(t))}function ht(e,t){let n=xe(e,"Attribute");if(n){let i=n.expression.expression.escapedText;t.kind=i==="EventAttribute"?o.Event:o.Attribute}}function Tt(e){let t=e.arguments[0];return l.isStringLiteral(t)?t.text:""}function bt(e){let t=u.getTypeAtLocation(e);for(;t;){let n=t.symbol.valueDeclaration;if(!n||!l.isClassDeclaration(n))return!1;let i=n.heritageClauses?.find(s=>s.token===l.SyntaxKind.ExtendsKeyword)?.types?.[0]?.expression,a=i&&u.getTypeAtLocation(i);if(!a||t===a)break;if(a.symbol?.name==="Component")return!0;t=a}}function xt(e,t,n){let i=xe(e,"Augment"),a=i?.expression?.arguments,s=n.docs||{};if(i||t&&bt(e))n.kind=o.Component;else return!1;if(n.children){let c=n.children.find(b=>b.name==="tagName"&&b.kind===o.Property&&b.flags&p.Static);c&&c.value&&(s.tagName=c.value.slice(1,-1))}return a&&a.forEach((c,b)=>{b===0&&l.isStringLiteral(c)?s.tagName=c.text:l.isCallExpression(c)&&l.isIdentifier(c.expression)&&c.expression.escapedText==="role"&&(s.role=Tt(c))}),(s.tagName||s.role)&&(n.docs=s),!!i}function m(e){let t=D(e);if(l.isVariableDeclaration(e)&&(l.isArrayBindingPattern(e.name)||l.isObjectBindingPattern(e.name))&&(t.children=e.name.elements.map(f)),h.cxlExtensions&&ht(e,t),!t.type){let n=e.type;if(n)t.type=f(n);else if(l.isFunctionDeclaration(e)||l.isMethodDeclaration(e)){let i=u.getSignatureFromDeclaration(e);i&&(t.type=T(i.getReturnType()))}else try{let i=u.getTypeAtLocation(e);i&&(t.type=T(i))}catch(i){console.error(i)}}if(l.isTypeAliasDeclaration(e)){let n=u.getTypeAtLocation(e);t.resolvedType=V(n)}return t}function F(e,t){e.children||=[];for(let n of t)n.parent||(Object.defineProperty(n,"parent",{value:e,enumerable:!1}),e.children.push(n))}function ee(e){let t=y(e);if(!t.children){let n=l.isObjectLiteralExpression(e)?e.properties.map(f):e.members.map(f);F(t,n)}return t}function St(e){let t=R(e),n=t&&ke(t);return n?E[n]:void 0}function H(e){if(e.$$fqn)return e.$$fqn;let t=e.getDeclarations()?.[0]?.getSourceFile()?.path;return t?e.$$fqn=`${t}.${e.getName()}`:e.$$fqn=u.getFullyQualifiedName(e)}function vt(e){if(!e)return;if(h.followReferences){let n=St(e);if(n){let i=n.children?.find(a=>a.name===e.name);if(i)return i}}let t=e&&I[H(e)];return t?.source?t:void 0}function j(e){let t=u.getSymbolAtLocation(e)||e.name&&u.getSymbolAtLocation(e.name),n;if(e.kind===r.InterfaceDeclaration&&t&&!(t.flags&l.SymbolFlags.Class)){if(n=t[k],!n&&t.declarations){let i=t.declarations.find(a=>a[k]);i&&(n=D(i))}n??=vt(t),n&&!(n.flags&p.Export)&&l.getCombinedModifierFlags(e)&l.ModifierFlags.Export&&(n.flags|=p.Export),t&&(t[k]??=n)}if(n??=D(e),e.members&&(!n.children||e.kind===r.InterfaceDeclaration)&&F(n,e.members.map(f)),n.children){for(let i of n.children)if(i.kind===o.Constructor&&i.parameters)for(let a of i.parameters)a.kind===o.Property&&F(n,[a])}if(t&&l.isInterfaceDeclaration(e)&&t.flags&l.SymbolFlags.Class){let i=t.declarations?.[0]||t.valueDeclaration;if(n.flags|=p.DeclarationMerge,n.children&&i){let a=J(t,i);a&&F(a,n.children.map(s=>({...s})))}}if(l.isClassDeclaration(e)&&h.cxlExtensions&&xt(e,t,n),e.heritageClauses?.length){let i=n.type={flags:0,kind:o.ClassType,name:"",type:n};if(e.heritageClauses.forEach(a=>F(i,a.types.map(f))),i.children)for(let a of i.children)a.kind===o.Reference&&a.type&&(a.type.extendedBy||(a.type.extendedBy=[])).push({name:n.name,type:n,kind:o.Reference,flags:0})}return n}function kt(e,t){let n=l.ObjectFlags,i=e.objectFlags&n.Interface?r.InterfaceDeclaration:void 0;return i?t.declarations?.find(a=>a.kind===i):t.declarations?.[0]||t.valueDeclaration}function te(e){let t=u.getTypeFromTypeNode(e),n=t.aliasSymbol||t.symbol;!n&&l.isTypeReferenceNode(e)&&(n=u.getSymbolAtLocation(e.typeName)),n&&n.flags&l.SymbolFlags.Alias&&(n=u.getAliasedSymbol(n)??n);let i=n&&kt(t,n),a=i&&n?J(n,i):e.flags&l.NodeFlags.Synthesized?void 0:T(t),s=G(l.isTypeReferenceNode(e)?e.typeName:e.expression);return a&&!a.name&&(a.name=s),y(e,{name:s,kind:o.Reference,type:a,typeParameters:e.typeArguments?.map(f)})}function Dt(e){return y(e,{children:[f(e.checkType),f(e.extendsType),f(e.trueType),f(e.falseType)]})}function ne(e){let t=S(e);return t.name="constructor",t}function wt(e){return y(e,{children:[f(e.objectType),f(e.indexType)]})}function Et(e){return y(e,{id:K(e),name:"__index",parameters:e.parameters.map(f),type:e.type&&f(e.type)})}function Ft(e){let t=y(e,{kind:le[e.operator],type:f(e.type)}),n=e.flags&l.NodeFlags.Synthesized?void 0:u.getTypeFromTypeNode(e);if(n){let i=n&&T(n);i&&i.kind!==t.kind&&(t.resolvedType=i)}return t}function Ct(e){let t=y(e);return t.name=G(e.exprName),t}function Pt(e){return y(e,{children:e.elements.map(f)})}function At(e){let t=f(e.type);return t.flags|=p.Rest,t}function Nt(e){let t=y(e);if(e.typeParameter){let n=f(e.typeParameter);t.children=[n],n.children?.[0]&&(t.children.push(n.children?.[0]),n.children=void 0)}return e.type&&(t.type=f(e.type)),t}function Lt(e){let t=u.getExportSpecifierLocalTargetSymbol(e);if(t){let n=be(t);return n.name=e.name.text,n.flags|=p.Export,n.kind===o.Unknown&&(n.kind=o.Export),n}return m(e)}function W(e){let t=h.rootDir??C?.options.rootDir??"";return ae(t,e)}function Se(e){let t=e,n=[e.valueDeclaration?.kind===r.SourceFile&&e.name.startsWith('"')?`"${W(e.name.slice(1,-1))}"`:e.name];for(;t=t.parent;)t.valueDeclaration?.kind!==r.SourceFile&&n.unshift(t.name);return n.join(".")}function It(e,t){let n=t?Se(t):void 0;if(t){if(t.$$moduleResult)return t.$$moduleResult;if(n&&h.followReferences){let a=De(t,e.getSourceFile())||E[n];if(a)return t.$$moduleResult=a}}let i=D(e);return t&&(t.$$moduleResult=i),n&&(h.forceExports?.includes(n)&&(i.flags|=p.Export),i.name=n,E[n]=i),i}function Rt(e,t){if(!e||P.includes(t))return!1;if(h.exportsOnly){let n=e;do{if(n.valueDeclaration?.kind===r.SourceFile)break;let i=n.$$moduleResult;if(!i||!(i.flags&p.Export))return!1}while(n=n.parent)}return!0}function ve(e){let t=u.getSymbolAtLocation(e)||e.name&&u.getSymbolAtLocation(e.name),n=It(e,t);return e.body?.forEachChild(i=>we(i,n)),t&&n.flags&p.Export&&Ee(t),Rt(t,n)&&P.push(n),n}function $t(e){let t=u.getSymbolAtLocation(e);if(t){let n=N(t);return n.kind=o.ImportType,n}return y(e,{})}function jt(e){let t=y(e);return t.children=[f(e.expression)],t}var Ot={[r.AnyKeyword]:()=>me,[r.StringKeyword]:()=>pe,[r.NumberKeyword]:()=>ce,[r.BooleanKeyword]:()=>ue,[r.VoidKeyword]:()=>ye,[r.NeverKeyword]:()=>ge,[r.NullKeyword]:()=>de,[r.FunctionType]:S,[r.CallSignature]:S,[r.ConstructSignature]:S,[r.UndefinedKeyword]:()=>fe,[r.ArrayType]:gt,[r.FunctionDeclaration]:S,[r.ArrowFunction]:S,[r.FunctionExpression]:S,[r.TypeReference]:te,[r.ExpressionWithTypeArguments]:te,[r.ConditionalType]:Dt,[r.ParenthesizedType]:m,[r.InferType](e){return y(e,{type:f(e.typeParameter)})},[r.TypeQuery]:Ct,[r.IndexedAccessType]:wt,[r.IntersectionType](e){return y(e,{kind:o.TypeIntersection,children:e.types.map(f)})},[r.UnionType](e){let t=e.$$resolvedType?void 0:u.getTypeAtLocation(e);return y(e,{kind:o.TypeUnion,children:e.types.map(f),resolvedType:t&&V(t)})},[r.TupleType]:Pt,[r.EnumDeclaration]:j,[r.EnumMember]:m,[r.RestType]:At,[r.PropertySignature]:m,[r.Constructor]:ne,[r.Parameter]:m,[r.PropertyDeclaration]:m,[r.MethodDeclaration]:S,[r.MethodSignature]:S,[r.ClassDeclaration]:j,[r.TypeAliasDeclaration]:m,[r.TypeParameter]:st,[r.InterfaceDeclaration]:j,[r.VariableDeclaration]:m,[r.BindingElement]:m,[r.ConstructorType]:ne,[r.GetAccessor]:S,[r.SetAccessor]:S,[r.TypeOperator]:Ft,[r.TypeLiteral]:ee,[r.TemplateLiteralType]:D,[r.ObjectLiteralExpression]:ee,[r.PropertyAssignment]:m,[r.ShorthandPropertyAssignment]:m,[r.IndexSignature]:Et,[r.MappedType]:Nt,[r.SpreadAssignment]:jt,[r.ModuleDeclaration]:ve,[r.NamespaceExport]:m,[r.NamespaceImport]:m,[r.ExportSpecifier]:Lt,[r.ImportType]:$t,[r.SymbolKeyword]:D};function Mt({options:e,errors:t,fileNames:n,projectReferences:i},a,s){e.noEmit=!0,s||(s=l.createCompilerHost(e)),g=l.createProgram({configFileParsingDiagnostics:t,rootNames:n,projectReferences:i,options:e,host:s}),u=g.getTypeChecker()}function ke(e){let t=e.kind===r.SourceFile?e:e.getSourceFile();return t.isDeclarationFile?t.originalFileName:void 0}function Bt(e){let t=g.getResolvedProjectReferences();if(t)return t.find(n=>n?.commandLine.fileNames.includes(e))}function De(e,t){let n=R(e);if(n&&l.isSourceFile(n)&&!M.includes(n))if(n.isDeclarationFile){if(h.followReferences){let i=ke(n),a=i&&Bt(i);if(a){Ce(a.commandLine);let s=W(i);return P.find(c=>c.name===s)}}if(t.isDeclarationFile)return L(n)}else return L(n)}function we(e,t){function n(i){let a=f(i);(!h.exportsOnly||a.flags&p.Export)&&F(t,[a])}if(l.isVariableStatement(e))e.declarationList.declarations.map(n);else if(l.isExportDeclaration(e)){if(e.exportClause)l.isNamedExports(e.exportClause)?e.exportClause.elements.forEach(n):n(e.exportClause);else if(e.moduleSpecifier){let i=u.getSymbolAtLocation(e.moduleSpecifier);i&&De(i,e.getSourceFile())}}else switch(e.kind){case r.InterfaceDeclaration:case r.TypeAliasDeclaration:case r.FunctionDeclaration:case r.EnumDeclaration:case r.VariableDeclaration:case r.ClassDeclaration:n(e);break;case r.ModuleDeclaration:ve(e)}}function Ee(e){e.exports?.forEach(t=>{let n=R(t);n?.[k]?.source&&!(n[k].flags&p.Internal)&&(I[H(t)]=n[k])})}function L(e){if(E[e.fileName])return E[e.fileName];let t=y(e);if(E[e.fileName]=t,t.flags&p.Internal)return t;e.forEachChild(i=>we(i,t));let n=u.getSymbolAtLocation(e);return n&&Ee(n),e.isDeclarationFile&&e.referencedFiles.forEach(i=>{let a=i.fileName;if(C?.fileNames.includes(a))return;let s=g.getSourceFile(a);s&&!g.isSourceFileDefaultLibrary(s)&&!g.isSourceFileFromExternalLibrary(s)&&L(s)}),t.children?.length&&P.push(t),t}function Fe(e){Mt(e),M=e.fileNames.flatMap(t=>g.getSourceFile(t)||[]),M.forEach(L)}function Ce(e){let t=e.options.configFilePath;if(!B.includes(t)){let n=g,i=u;B.push(t),Fe(e),g=n,u=i}}function Pe(e,t){h=t,E={},I={},B=[];let n={modules:P||=[],index:he||={},config:e,env:{typescript:l.version}};return e.projectReferences?.forEach(i=>{i.prepend&&Ce(Te(l.resolveProjectReferencePath(i)))}),Fe(e),n}function Ut(e,t,n){return C=l.parseJsonConfigFileContent(e,U,t),Pe(C,{...se,...n})}function Kt(e=Ge("tsconfig.json"),t){let n={...se,...t};return C=Te(e,n),Pe(C,n)}var en={repository:{type:"string",help:"URL of the source code repository (e.g., GitHub repository URL)"},clean:{help:"Removes all existing files from the output directory before generating documentation."},outputDir:{short:"o",type:"string",help:"Specifies the output directory where the generated documentation will be saved."},scripts:{type:"string",many:!0,help:"List of additional scripts (paths) to include in the generated documentation HTML."},demoScripts:{type:"string",many:!0,help:"List of scripts (paths) to include in the generated documentation demo output."},packageJson:{help:'Path to the package.json file. Defaults to "./package.json" if not specified.',type:"string"},packageName:{help:"Sets the title of the generated documentation. Defaults to the name property in package.json.",type:"string"},summary:{help:'Enables generation of a "summary.json" file.',type:"boolean"},sitemap:{help:"Generates a sitemap for the documentation using the provided value as the base URL.",type:"string"},file:{help:"Allows parsing of a single file instead of an entire project.",type:"string",many:!0},tsconfig:{help:'Path to the tsconfig.json file used for TypeScript compilation. Defaults to "./tsconfig.json" if not specified.',type:"string"},markdown:{help:"Enables rendering of markdown syntax within symbol descriptions.",type:"boolean"},typeRoots:{help:"Specify additional type root directories (paths) for TypeScript projects (can be used multiple times).",type:"string",many:!0},docsJson:{help:'Path to a custom "docs.json" file for configuring documentation generation.',type:"string"},baseHref:{help:"Sets the base URL for markdown links within the generated documentation.",type:"string"},exclude:{help:"List of modules (paths) to exclude from documentation generation (can be used multiple times).",type:"string",many:!0},rootDir:{help:"Overrides the default root directory used for resolving TypeScript project file names.",type:"string"},customJsDocTags:{help:"Allows declaration of custom jsdoc tags for documentation (can be used multiple times).",type:"string",many:!0},cxlExtensions:{help:"Enables support for Coaxial UI extensions within the generated documentation.",type:"boolean"},exports:{help:"Treats specific symbols (paths) as exported even if not explicitly marked.",type:"string",many:!0},followReferences:{help:"Includes documentation from symbols referenced in project references.",type:"boolean"},headHtml:{help:"Path to a file containing custom HTML to be added to the `<head>` element of the generated page.",type:"string"},noHtml:{help:"Do not generate HTML",type:"boolean"},debug:{help:"Enables debug mode to print detailed output during documentation generation.",type:"boolean"}},Gt=/[&<"]/g,Jt={"&":"&","<":"<",'"':"""};function tn(e){return e.replace(Gt,t=>Jt[t])}function nn(e){if(e.startsWith("<caption>")){let t=e.indexOf(`
|
|
4
|
+
`);return{title:e.slice(0,t).trim().replace("</caption>",""),value:e=e.slice(t).trim()}}return{title:"",value:e}}async function rn(e,t){let n={outputDir:"./docs",clean:!1,debug:!1,spa:!1,tsconfig:"tsconfig.json",packageJson:"package.json",packageRoot:"",summary:!1,...e};(n.docsJson||Ae("docs.json"))&&Object.assign(n,await Q(n.docsJson||"docs.json"));function i(x){return Ke(`rm -f ${x}/*.html ${x}/*.json ${x}/*.js`)}let a=n.outputDir,s=await Q(n.packageJson);if(n.packageRoot??=q(Le(n.packageJson)),await O(a),await O(a+"/"+s.version),n.clean&&(await i(a),await i(Ne(a,s.version))),n.repository===void 0&&s?.repository){let x=s.repository;n.repository=typeof x=="string"?x:x.url}let c={rootDir:n.rootDir,exportsOnly:!0,customJsDocTags:n.customJsDocTags,cxlExtensions:n.cxlExtensions||!1,forceExports:n.exports,followReferences:n.followReferences},b=n.file?.length?Ut({compilerOptions:{allowJs:!0,rootDir:q(n.file[0]),sourceMap:!1,typeRoots:n.typeRoots||[],noEmit:!0,lib:["es2021"]},files:n.file},process.cwd(),c):Kt(n.tsconfig,c),w={...n,modulePackage:s,repositoryLink:n.repository};if(n.summary){let x=await import("./render-summary-H5JT7BDG-ETDG4C5Q.js");await Promise.all(x.render(w,b).map($=>t($,a)))}if(!n.noHtml){let x=await import("./render-html-27TCOWOE-TXOI62NA.js");await Promise.all(x.render(w,b).map($=>t($,a)))}}export{o as a,p as b,en as c,tn as d,nn as e,rn as f};
|
package/index.bundle.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as i,b as r,c as o,d as a,e as t,f as m,g as l,h as p,i as b,j as f,k as n,l as d,m as s}from"./chunk-
|
|
2
|
+
import{a as i,b as r,c as o,d as a,e as t,f as m,g as l,h as p,i as b,j as f,k as n,l as d,m as s}from"./chunk-CC5X4GUA.js";import"./chunk-FSRPMVAS.js";if(import.meta.main){let{buildLibrary:e}=await import("./library-UNJOIIL7.js");await e()}export{p as basename,a as build,s as buildLibrary,b as concatFile,n as copyDir,i as esbuild,t as exec,l as file,f as files,o as pkg,r as readme,m as shell,d as zip};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as a}from"./chunk-CC5X4GUA.js";import"./chunk-FSRPMVAS.js";export{a as buildLibrary};
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|