ts-pantry 0.11.155 → 0.11.156
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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{T,B}from"../chunk-
|
|
2
|
+
import{T,B}from"../chunk-9e67q1h0.js";import{a,j,r,h,f,S,J,ye,y,q,A,R,X,ke,ve,n,Z,I,d,ae,z,E,O,L,l,te,Ce,je,Se,ha,fa}from"../chunk-2jrdx31x.js";import"../chunk-tvtdwcr8.js";import"../chunk-xrxz3107.js";import{Sa}from"../chunk-tfd285s6.js";import g from"node:fs";import v from"node:path";import s from"node:process";j();async function se(t="src/pantry"){if(!g.existsSync(t))throw Error(`Pantry directory not found: ${t}. Please run 'bun ./bin/cli.ts update-pantry' first.`);let e=[];function o(i,c=""){let u=g.readdirSync(i,{withFileTypes:!0}),p=v.join(i,"package.yml");if(c&&g.existsSync(p))e.push(c);for(let x of u)if(x.isDirectory()&&!x.name.startsWith(".")){let w=c?`${c}/${x.name}`:x.name,b=v.join(i,x.name);o(b,w)}}return o(t),console.log(`\uD83D\uDCE6 Found ${e.length} packages in local pantry`),e.sort()}async function ce(t=!1){async function e(p){let x=new URL("https://s3.amazonaws.com/dist.tea.xyz/");if(x.searchParams.set("list-type","2"),x.searchParams.set("prefix",""),x.searchParams.set("max-keys","1000"),p)x.searchParams.set("continuation-token",p);let w=await fetch(x.toString());if(!w.ok)throw Error(`Failed to fetch S3 listing: ${w.status}`);let b=await w.text(),U=[],G=b.match(/<Key>([^<]+)<\/Key>/g);if(G)for(let H of G){let _=H.replace(/<Key>([^<]+)<\/Key>/,"$1");U.push({Key:_})}let k=b.includes("<IsTruncated>true</IsTruncated>"),N=b.match(/<NextContinuationToken>([^<]+)<\/NextContinuationToken>/),m=N?N[1]:void 0;return{IsTruncated:k,NextContinuationToken:m,Contents:U}}console.log("Scraping packages from S3 registry...");let o=new Set,i;do{let p=await e(i);for(let x of p.Contents){let w=x.Key,b=w.split("/");if(b.length===0)continue;if(b[0].startsWith(".")||b[0].includes(" ")||w.match(/\.(md|txt|yml|yaml|json)$/i))continue;let U=["darwin","linux","windows"],G=-1;for(let k=1;k<b.length;k++)if(U.includes(b[k])){G=k;break}if(G>0){let k=b.slice(0,G).join("/");if(k.includes("."))o.add(k)}else if(b.length>=2&&b[0].includes(".")&&!b[1].startsWith("v")&&!b[1].match(/^\d/)){let k=`${b[0]}/${b[1]}`;o.add(k)}else if(b.length>=1&&b[0].includes("."))o.add(b[0])}i=p.NextContinuationToken,console.log(`Found ${o.size} packages so far...`)}while(i);let c=Array.from(o).sort(),u=[];for(let p of c){if(!p.includes(".")||p.match(/^[a-z0-9.-]+\.[a-z]{2,}(\/[\w.-]+){0,20}$/i)===null)continue;if(p.endsWith("/README.rst")||p.endsWith("/README")||p.includes("/docs/"))continue;if(p.endsWith("/.pkgroot"))continue;if(["amazon.com/aws","charm.sh","code.videolan.org","crates.io"].includes(p))continue;u.push(p)}return console.log(`\uD83D\uDCE6 Found ${u.length} valid packages in registry`),u}async function le(t,e){let i=`/**
|
|
3
3
|
* Constants used throughout the ts-pantry package
|
|
4
4
|
* This file is auto-generated from ${e}. Do not edit manually.
|
|
5
5
|
* Generated on ${new Date().toISOString()}
|
package/dist/bin/desktop.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import{T,B}from"../chunk-
|
|
2
|
+
import{T,B}from"../chunk-9e67q1h0.js";import"../chunk-xrxz3107.js";import"../chunk-m0wa29w0.js";import{F,Y,ue,Re}from"../chunk-1e7d8cfn.js";import{chmodSync as h,mkdirSync as m,renameSync as v,rmSync as P,writeFileSync as k}from"node:fs";import{homedir as b}from"node:os";import{isAbsolute as S,join as s}from"node:path";var a=(t)=>t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'");function x(t,e,r){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
3
3
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
4
4
|
<plist version="1.0"><dict>
|
|
5
5
|
<key>Label</key><string>dev.pantry.desktop</string>
|
|
@@ -27,5 +27,5 @@ Received ${s}, cleaning up...`),e)try{await e()}catch(i){console.error("Error du
|
|
|
27
27
|
`)),this.enableDidYouMean){let t=[];for(let i of this.commands){if(i.displayName)t.push(i.displayName);if(i.aliasNames)t.push(...i.aliasNames)}let s=q(e,t);if(s.length>0)console.log(C.yellow("Did you mean one of these?")),s.forEach((i)=>console.log(` ${C.dim("•")} ${this.name} ${i}`)),console.log("")}console.log(C.dim("Run"),`${this.name} --help`,C.dim("to see all available commands")),v.exit(1)}async parse(e=G,t={}){let{run:s=!0,exitOnError:i=!1}=t;if(i)try{return await this.parse(e,{run:s})}catch(n){throw this.handleUsageError(n),n}if(this.rawArgs=e,!this.name)this.name=e[1]?ne(e[1]):"cli";let o=!0,a=e.slice(2),h=a[0];if(h&&!h.startsWith("-")){for(let n of this.commands)if(n.isMatched(h)){let r=this.mri(a,n);o=!1;let u={...r,args:r.args.slice(1)};this.setParsedInfo(u,n,h),this.emit(`command:${h}`,n);break}if(o){let n=a[1];if(n&&!n.startsWith("-")){let r=`${h}:${n}`;for(let u of this.commands)if(u.isMatched(r)){let m=this.mri(a,u);o=!1;let l={...m,args:m.args.slice(2)};this.setParsedInfo(l,u,r),this.emit(`command:${r}`,u);break}}}}if(o){for(let n of this.commands)if(n.name===""){o=!1;let r=this.mri(a,n);this.setParsedInfo(r,n),this.emit("command:!",n);break}}if(o){let n=this.mri(e.slice(2));this.setParsedInfo(n)}if(this.options.verbose)this.isVerbose=!0;if(this.options.quiet)this.isQuiet=!0;if(this.options.debug)this.isDebug=!0;if(this.options.noInteraction||this.options.interaction===!1)this.isNoInteraction=!0;if(this.options.env)this.environment=String(this.options.env);if(this.options.dryRun)this.isDryRun=!0;if(this.options.force)this.isForce=!0;if(this.options.noEmoji||this.options.emoji===!1)this.useEmoji=!1;if(this.options.theme)this.theme=String(this.options.theme);if(this.options.noCache||this.options.cache===!1)this.isNoCache=!0;if(this.options.help&&this.showHelpOnExit)this.outputHelp(),s=!1,this.unsetMatchedCommand();if(this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null)this.outputVersion(),s=!1,this.unsetMatchedCommand();let c={args:this.args,options:this.options};if(s)await this.runMatchedCommand();if(!this.matchedCommand&&this.args[0]){if(this.emit("command:*"),!(this.listenerCount("command:*")>0))this.showCommandNotFound(this.args[0])}return c}mri(e,t){let s=[...this.globalCommand.options,...t?t.options:[]],i=te(s),o=[],a=e.indexOf("--");if(a>-1)o=e.slice(a+1),e=e.slice(0,a);let h=le(e,i),c={_:h._};for(let l of Object.keys(h))if(l!=="_")c[I(l)]=h[l];let n=c._,r={"--":o},u=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,m=Object.create(null);for(let l of s){if(!u&&l.config.default!==void 0)for(let b of l.names)r[b]=l.config.default;if(Array.isArray(l.config.type)){if(m[l.name]===void 0)m[l.name]={shouldTransform:!0,transformFunction:l.config.type[0]}}}for(let l of Object.keys(c))if(l!=="_"){let b=l.split(".");se(r,b,c[l]),ie(r,m)}return{args:n,options:r}}async run(e=G){return this.parse(e,{run:!0,exitOnError:!0})}handleUsageError(e){if(!re(e)||e.isUsageError===!1)return;let t=e.message||"command-line error",s=this.name?`${this.name}: `:"",i=/--help/.test(t)?"":e.usage?`
|
|
28
28
|
Usage: ${e.usage}`:`
|
|
29
29
|
Run \`${this.name??"cli"} --help\` for usage.`;v.stderr.write(`${s}${t}${i}
|
|
30
|
-
`),v.exit(e.exitCode??2)}async runMatchedCommand(){let{args:e,options:t,matchedCommand:s}=this;if(!s||!s.commandAction)return;s.checkUnknownOptions(),s.checkOptionValue(),s.checkRequiredArgs();let i=[];s.args.forEach((c,n)=>{if(c.variadic)i.push(e.slice(n));else i.push(e[n])}),i.push(t);let o={command:s,args:i,options:t};for(let c of s.beforeHooks)await c(o);let a,h=async()=>{let c=s.commandAction.apply(this,i);if(c instanceof Promise)a=await c;else a=c;return a};if(s.middleware.length>0){let c=0,n=async()=>{if(c<s.middleware.length){let r=s.middleware[c++];await r({...o,next:n})}else await h()};await n()}else await h();for(let c of s.afterHooks)await c(o);return a}removeSignalHandlers(){if(!this.signalHandlersSet)return this;return v.removeAllListeners("SIGINT"),v.removeAllListeners("SIGTERM"),this.signalHandlersSet=!1,this}destroy(){this.removeSignalHandlers(),this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.matchedCommand=void 0,this.matchedCommandName=void 0,this.removeAllListeners()}}class J{cache;enabled;cleanupInterval=null;hits=0;misses=0;constructor(){this.cache=new Map,this.enabled=!0,this.startCleanupInterval()}startCleanupInterval(){if(this.cleanupInterval)return;this.cleanupInterval=setInterval(()=>{this.cleanup()},30000),this.cleanupInterval.unref()}stopCleanup(){if(this.cleanupInterval)clearInterval(this.cleanupInterval),this.cleanupInterval=null}isEnabled(){return this.enabled}get(e){if(!this.enabled){this.misses++;return}let t=this.cache.get(e);if(!t){this.misses++;return}if(Date.now()-t.timestamp>t.ttl){this.cache.delete(e),this.misses++;return}return this.hits++,t.value}set(e,t,s=5000){if(!this.enabled)return;this.cache.set(e,{value:t,timestamp:Date.now(),ttl:s})}has(e){if(!this.enabled)return!1;let t=this.cache.get(e);if(!t)return!1;if(Date.now()-t.timestamp>t.ttl)return this.cache.delete(e),!1;return!0}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}disable(){this.enabled=!1,this.clear()}enable(){this.enabled=!0}stats(){return{size:this.cache.size,enabled:this.enabled,hits:this.hits,misses:this.misses}}resetStats(){this.hits=0,this.misses=0}keys(){return Array.from(this.cache.keys())}cleanup(){let e=Date.now();for(let[t,s]of this.cache.entries())if(e-s.timestamp>s.ttl)this.cache.delete(t)}destroy(){this.stopCleanup(),this.clear(),this.resetStats()}}var at=new J;function fe(){if("FORCE_COLOR"in S.env)return S.env.FORCE_COLOR!=="0";if("NO_COLOR"in S.env||S.env.TERM==="dumb")return!1;if(S.platform==="win32")return!0;return U.isatty(1)&&U.isatty(2)}var Q=fe();function p(e,t){if(!Q)return(s)=>s;return(s)=>e+s+t}var pe=p("\x1B[0m","\x1B[0m"),ge=p("\x1B[31m","\x1B[39m"),$e=p("\x1B[32m","\x1B[39m"),be=p("\x1B[33m","\x1B[39m"),ve=p("\x1B[34m","\x1B[39m"),we=p("\x1B[35m","\x1B[39m"),ye=p("\x1B[36m","\x1B[39m"),xe=p("\x1B[37m","\x1B[39m"),Ce=p("\x1B[90m","\x1B[39m"),Se=p("\x1B[1m","\x1B[22m"),Ie=p("\x1B[3m","\x1B[23m"),_e=p("\x1B[4m","\x1B[24m"),Oe=p("\x1B[2m","\x1B[22m"),ke=p("\x1B[7m","\x1B[27m"),Ee=p("\x1B[8m","\x1B[28m"),Be=p("\x1B[9m","\x1B[29m"),Te=p("\x1B[41m","\x1B[49m"),je=p("\x1B[42m","\x1B[49m"),Ve=p("\x1B[43m","\x1B[49m"),Ae=p("\x1B[44m","\x1B[49m"),Me=p("\x1B[45m","\x1B[49m"),Ne=p("\x1B[46m","\x1B[49m"),Re=p("\x1B[47m","\x1B[49m"),Le=Q,De={reset:pe,red:ge,green:$e,yellow:be,blue:ve,magenta:we,cyan:ye,white:xe,gray:Ce,bold:Se,italic:Ie,underline:_e,dim:Oe,inverse:ke,hidden:Ee,strikethrough:Be,bgRed:Te,bgGreen:je,bgYellow:Ve,bgBlue:Ae,bgMagenta:Me,bgCyan:Ne,bgWhite:Re,isColorSupported:Le},We=De,ze=["up","down","left","right","space","enter","cancel"],dt={actions:new Set(ze),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};var ft=Pe.platform.startsWith("win"),pt=Symbol("clapp:cancel");var Fe=oe();var f=(e,t)=>Fe?e:t,gt=f("◆","*"),$t=f("■","x"),bt=f("▲","x"),vt=f("◇","o"),wt=f("┌","T"),He=f("│","|"),yt=f("└","—"),xt=f("●",">"),Ct=f("○"," "),St=f("◻","[•]"),It=f("◼","[+]"),_t=f("◻","[ ]"),Ot=f("▪","•"),kt=f("─","-"),Et=f("╮","+"),Bt=f("├","+"),Tt=f("╯","+"),jt=f("●","•"),Vt=f("◆","*"),At=f("▲","!"),Mt=f("■","x");var Nt={light:f("─","-"),heavy:f("━","="),block:f("█","#")};function Ge(){return`${We.gray(He)} `}var Rt=Ge();var B="0.11.
|
|
30
|
+
`),v.exit(e.exitCode??2)}async runMatchedCommand(){let{args:e,options:t,matchedCommand:s}=this;if(!s||!s.commandAction)return;s.checkUnknownOptions(),s.checkOptionValue(),s.checkRequiredArgs();let i=[];s.args.forEach((c,n)=>{if(c.variadic)i.push(e.slice(n));else i.push(e[n])}),i.push(t);let o={command:s,args:i,options:t};for(let c of s.beforeHooks)await c(o);let a,h=async()=>{let c=s.commandAction.apply(this,i);if(c instanceof Promise)a=await c;else a=c;return a};if(s.middleware.length>0){let c=0,n=async()=>{if(c<s.middleware.length){let r=s.middleware[c++];await r({...o,next:n})}else await h()};await n()}else await h();for(let c of s.afterHooks)await c(o);return a}removeSignalHandlers(){if(!this.signalHandlersSet)return this;return v.removeAllListeners("SIGINT"),v.removeAllListeners("SIGTERM"),this.signalHandlersSet=!1,this}destroy(){this.removeSignalHandlers(),this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.matchedCommand=void 0,this.matchedCommandName=void 0,this.removeAllListeners()}}class J{cache;enabled;cleanupInterval=null;hits=0;misses=0;constructor(){this.cache=new Map,this.enabled=!0,this.startCleanupInterval()}startCleanupInterval(){if(this.cleanupInterval)return;this.cleanupInterval=setInterval(()=>{this.cleanup()},30000),this.cleanupInterval.unref()}stopCleanup(){if(this.cleanupInterval)clearInterval(this.cleanupInterval),this.cleanupInterval=null}isEnabled(){return this.enabled}get(e){if(!this.enabled){this.misses++;return}let t=this.cache.get(e);if(!t){this.misses++;return}if(Date.now()-t.timestamp>t.ttl){this.cache.delete(e),this.misses++;return}return this.hits++,t.value}set(e,t,s=5000){if(!this.enabled)return;this.cache.set(e,{value:t,timestamp:Date.now(),ttl:s})}has(e){if(!this.enabled)return!1;let t=this.cache.get(e);if(!t)return!1;if(Date.now()-t.timestamp>t.ttl)return this.cache.delete(e),!1;return!0}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}disable(){this.enabled=!1,this.clear()}enable(){this.enabled=!0}stats(){return{size:this.cache.size,enabled:this.enabled,hits:this.hits,misses:this.misses}}resetStats(){this.hits=0,this.misses=0}keys(){return Array.from(this.cache.keys())}cleanup(){let e=Date.now();for(let[t,s]of this.cache.entries())if(e-s.timestamp>s.ttl)this.cache.delete(t)}destroy(){this.stopCleanup(),this.clear(),this.resetStats()}}var at=new J;function fe(){if("FORCE_COLOR"in S.env)return S.env.FORCE_COLOR!=="0";if("NO_COLOR"in S.env||S.env.TERM==="dumb")return!1;if(S.platform==="win32")return!0;return U.isatty(1)&&U.isatty(2)}var Q=fe();function p(e,t){if(!Q)return(s)=>s;return(s)=>e+s+t}var pe=p("\x1B[0m","\x1B[0m"),ge=p("\x1B[31m","\x1B[39m"),$e=p("\x1B[32m","\x1B[39m"),be=p("\x1B[33m","\x1B[39m"),ve=p("\x1B[34m","\x1B[39m"),we=p("\x1B[35m","\x1B[39m"),ye=p("\x1B[36m","\x1B[39m"),xe=p("\x1B[37m","\x1B[39m"),Ce=p("\x1B[90m","\x1B[39m"),Se=p("\x1B[1m","\x1B[22m"),Ie=p("\x1B[3m","\x1B[23m"),_e=p("\x1B[4m","\x1B[24m"),Oe=p("\x1B[2m","\x1B[22m"),ke=p("\x1B[7m","\x1B[27m"),Ee=p("\x1B[8m","\x1B[28m"),Be=p("\x1B[9m","\x1B[29m"),Te=p("\x1B[41m","\x1B[49m"),je=p("\x1B[42m","\x1B[49m"),Ve=p("\x1B[43m","\x1B[49m"),Ae=p("\x1B[44m","\x1B[49m"),Me=p("\x1B[45m","\x1B[49m"),Ne=p("\x1B[46m","\x1B[49m"),Re=p("\x1B[47m","\x1B[49m"),Le=Q,De={reset:pe,red:ge,green:$e,yellow:be,blue:ve,magenta:we,cyan:ye,white:xe,gray:Ce,bold:Se,italic:Ie,underline:_e,dim:Oe,inverse:ke,hidden:Ee,strikethrough:Be,bgRed:Te,bgGreen:je,bgYellow:Ve,bgBlue:Ae,bgMagenta:Me,bgCyan:Ne,bgWhite:Re,isColorSupported:Le},We=De,ze=["up","down","left","right","space","enter","cancel"],dt={actions:new Set(ze),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};var ft=Pe.platform.startsWith("win"),pt=Symbol("clapp:cancel");var Fe=oe();var f=(e,t)=>Fe?e:t,gt=f("◆","*"),$t=f("■","x"),bt=f("▲","x"),vt=f("◇","o"),wt=f("┌","T"),He=f("│","|"),yt=f("└","—"),xt=f("●",">"),Ct=f("○"," "),St=f("◻","[•]"),It=f("◼","[+]"),_t=f("◻","[ ]"),Ot=f("▪","•"),kt=f("─","-"),Et=f("╮","+"),Bt=f("├","+"),Tt=f("╯","+"),jt=f("●","•"),Vt=f("◆","*"),At=f("▲","!"),Mt=f("■","x");var Nt={light:f("─","-"),heavy:f("━","="),block:f("█","#")};function Ge(){return`${We.gray(He)} `}var Rt=Ge();var B="0.11.156";
|
|
31
31
|
export{T,B};
|
package/package.json
CHANGED