ts-pantry 0.9.19 → 0.9.21
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 +7 -7
- package/dist/chunk-2dk28v6k.js +2 -0
- package/dist/chunk-2nfjspwd.js +1 -0
- package/dist/{chunk-85nbpqdk.js → chunk-9f0255fc.js} +1 -1
- package/dist/chunk-b0zr0ad6.js +1 -0
- package/dist/{chunk-tj5t6gft.js → chunk-bmr9qds3.js} +1 -1
- package/dist/chunk-cdzdw53j.js +42 -0
- package/dist/chunk-f2c8kapq.js +2 -0
- package/dist/chunk-h8phykmh.js +1 -0
- package/dist/chunk-jym7xrra.js +2 -0
- package/dist/chunk-k4yefwkp.js +142 -0
- package/dist/chunk-nqztmdqz.js +275 -0
- package/dist/{chunk-r54nadvd.js → chunk-p9e5z92g.js} +1 -1
- package/dist/{chunk-5y0crbzc.js → chunk-q7s2k65w.js} +2 -2
- package/dist/{chunk-8f13z8n1.js → chunk-t8296krc.js} +1 -1
- package/dist/{chunk-2kx0m76s.js → chunk-xkm30wah.js} +2 -2
- package/dist/chunk-y5rfbg9v.js +11 -0
- package/dist/{chunk-c1hyjq5h.js → chunk-yjz3e391.js} +1 -1
- package/dist/consts.d.ts +1 -1
- package/dist/desktop-apps.d.ts +1 -0
- package/dist/installer.d.ts +5 -0
- package/dist/packages/alacrittyorg.d.ts +1 -1
- package/dist/packages/aliases.d.ts +7 -7
- package/dist/packages/alttabapp.d.ts +1 -1
- package/dist/packages/ansiblecom.d.ts +1 -1
- package/dist/packages/apktoolorg.d.ts +1 -1
- package/dist/packages/arkadedev.d.ts +1 -1
- package/dist/packages/atlasgoio.d.ts +1 -1
- package/dist/packages/augeasnet.d.ts +1 -1
- package/dist/packages/babashkaorg.d.ts +1 -1
- package/dist/packages/borepub.d.ts +1 -1
- package/dist/packages/bufbuild.d.ts +1 -1
- package/dist/packages/bytebasecom.d.ts +1 -1
- package/dist/packages/casdoororg.d.ts +1 -1
- package/dist/packages/ccachedev.d.ts +1 -1
- package/dist/packages/certbotefforg.d.ts +1 -1
- package/dist/packages/chezmoiio.d.ts +1 -1
- package/dist/packages/circlecicom.d.ts +1 -1
- package/dist/packages/cligithubcom.d.ts +1 -1
- package/dist/packages/cmakeorg.d.ts +1 -1
- package/dist/packages/cnqueryio.d.ts +1 -1
- package/dist/packages/codercom.d.ts +1 -1
- package/dist/packages/codevisualstudiocom.d.ts +1 -1
- package/dist/packages/cointopsh.d.ts +1 -1
- package/dist/packages/conftestdev.d.ts +1 -1
- package/dist/packages/consulio.d.ts +1 -1
- package/dist/packages/convcogithubio.d.ts +1 -1
- package/dist/packages/cuelangorg.d.ts +1 -1
- package/dist/packages/cythonorg.d.ts +1 -1
- package/dist/packages/daggerio.d.ts +1 -1
- package/dist/packages/daytonaio.d.ts +1 -1
- package/dist/packages/dblabdanvergaracom.d.ts +1 -1
- package/dist/packages/denoland.d.ts +1 -1
- package/dist/packages/depotdev.d.ts +1 -1
- package/dist/packages/dgraphio.d.ts +1 -1
- package/dist/packages/direnvnet.d.ts +1 -1
- package/dist/packages/dotnetmicrosoftcom.d.ts +1 -1
- package/dist/packages/dozzledev.d.ts +1 -1
- package/dist/packages/dprintdev.d.ts +1 -1
- package/dist/packages/duckdborg.d.ts +1 -1
- package/dist/packages/eksctlio.d.ts +1 -1
- package/dist/packages/elementsprojectorg.d.ts +1 -1
- package/dist/packages/encoredev.d.ts +1 -1
- package/dist/packages/etcdio.d.ts +1 -1
- package/dist/packages/fastlanetools.d.ts +1 -1
- package/dist/packages/fishshellcom.d.ts +1 -1
- package/dist/packages/flyio.d.ts +1 -1
- package/dist/packages/freetdsorg.d.ts +1 -1
- package/dist/packages/getcomposerorg.d.ts +1 -1
- package/dist/packages/getsynthcom.d.ts +1 -1
- package/dist/packages/getzolaorg.d.ts +1 -1
- package/dist/packages/gflagsgithubio.d.ts +1 -1
- package/dist/packages/ghostscriptcom.d.ts +1 -1
- package/dist/packages/gleamrun.d.ts +1 -1
- package/dist/packages/gohugoio.d.ts +1 -1
- package/dist/packages/goreleasercom.d.ts +1 -1
- package/dist/packages/gourceio.d.ts +1 -1
- package/dist/packages/granteddev.d.ts +1 -1
- package/dist/packages/graphitesilorg.d.ts +1 -1
- package/dist/packages/groongaorg.d.ts +1 -1
- package/dist/packages/grpcio.d.ts +1 -1
- package/dist/packages/harfbuzzorg.d.ts +1 -1
- package/dist/packages/hasuraio.d.ts +1 -1
- package/dist/packages/helmsh.d.ts +1 -1
- package/dist/packages/htopdev.d.ts +1 -1
- package/dist/packages/httpieio.d.ts +1 -1
- package/dist/packages/huggingfaceco.d.ts +1 -1
- package/dist/packages/imagemagickorg.d.ts +1 -1
- package/dist/packages/index.d.ts +1653 -1653
- package/dist/packages/infracostio.d.ts +1 -1
- package/dist/packages/ipythonorg.d.ts +1 -1
- package/dist/packages/irohcomputer.d.ts +1 -1
- package/dist/packages/istioio.d.ts +1 -1
- package/dist/packages/jbangdev.d.ts +1 -1
- package/dist/packages/jemallocnet.d.ts +1 -1
- package/dist/packages/jujuis.d.ts +1 -1
- package/dist/packages/julialangorg.d.ts +1 -1
- package/dist/packages/jumppaddev.d.ts +1 -1
- package/dist/packages/k3dio.d.ts +1 -1
- package/dist/packages/k6io.d.ts +1 -1
- package/dist/packages/kagglecom.d.ts +1 -1
- package/dist/packages/kubectxdev.d.ts +1 -1
- package/dist/packages/kubesharkco.d.ts +1 -1
- package/dist/packages/laravelcom.d.ts +1 -1
- package/dist/packages/lavinmqcom.d.ts +1 -1
- package/dist/packages/libcxxllvmorg.d.ts +1 -1
- package/dist/packages/libeventorg.d.ts +1 -1
- package/dist/packages/libexifgithubio.d.ts +1 -1
- package/dist/packages/libgdgithubio.d.ts +1 -1
- package/dist/packages/libssh2org.d.ts +1 -1
- package/dist/packages/libusbinfo.d.ts +1 -1
- package/dist/packages/libuvorg.d.ts +1 -1
- package/dist/packages/libvipsorg.d.ts +1 -1
- package/dist/packages/libziporg.d.ts +1 -1
- package/dist/packages/liteclicom.d.ts +1 -1
- package/dist/packages/littlecmscom.d.ts +1 -1
- package/dist/packages/llmdatasetteio.d.ts +1 -1
- package/dist/packages/llvmorg.d.ts +1 -1
- package/dist/packages/localaiio.d.ts +1 -1
- package/dist/packages/luarocksorg.d.ts +1 -1
- package/dist/packages/lxmlde.d.ts +1 -1
- package/dist/packages/macfusegithubio.d.ts +1 -1
- package/dist/packages/macvimorg.d.ts +1 -1
- package/dist/packages/mailpitaxllentorg.d.ts +1 -1
- package/dist/packages/maturinrs.d.ts +1 -1
- package/dist/packages/mavenapacheorg.d.ts +1 -1
- package/dist/packages/meilisearchcom.d.ts +1 -1
- package/dist/packages/mercurerocks.d.ts +1 -1
- package/dist/packages/mesonbuildcom.d.ts +1 -1
- package/dist/packages/misejdxdev.d.ts +1 -1
- package/dist/packages/mitmproxyorg.d.ts +1 -1
- package/dist/packages/mkcertdev.d.ts +1 -1
- package/dist/packages/moshorg.d.ts +1 -1
- package/dist/packages/msgpackorg.d.ts +1 -1
- package/dist/packages/neovimio.d.ts +1 -1
- package/dist/packages/networkxorg.d.ts +1 -1
- package/dist/packages/nginxorg.d.ts +1 -1
- package/dist/packages/nodejsorg.d.ts +1 -1
- package/dist/packages/nomadprojectio.d.ts +1 -1
- package/dist/packages/npmjscom.d.ts +1 -1
- package/dist/packages/numpyorg.d.ts +1 -1
- package/dist/packages/nushellsh.d.ts +1 -1
- package/dist/packages/odigosio.d.ts +1 -1
- package/dist/packages/ohmyposhdev.d.ts +1 -1
- package/dist/packages/ollamaai.d.ts +1 -1
- package/dist/packages/onefetchdev.d.ts +1 -1
- package/dist/packages/openblasnet.d.ts +1 -1
- package/dist/packages/opencodeai.d.ts +1 -1
- package/dist/packages/openexrcom.d.ts +1 -1
- package/dist/packages/openjpegorg.d.ts +1 -1
- package/dist/packages/openmpllvmorg.d.ts +1 -1
- package/dist/packages/openpolicyagentorg.d.ts +1 -1
- package/dist/packages/opensearchorg.d.ts +1 -1
- package/dist/packages/opentofuorg.d.ts +1 -1
- package/dist/packages/orasland.d.ts +1 -1
- package/dist/packages/packerio.d.ts +1 -1
- package/dist/packages/phpnet.d.ts +1 -1
- package/dist/packages/pinnipeddev.d.ts +1 -1
- package/dist/packages/pipenvpypaio.d.ts +1 -1
- package/dist/packages/pkgxsh.d.ts +1 -1
- package/dist/packages/planetscalecom.d.ts +1 -1
- package/dist/packages/pocketbaseio.d.ts +1 -1
- package/dist/packages/podmanio.d.ts +1 -1
- package/dist/packages/postgrestorg.d.ts +1 -1
- package/dist/packages/prefixdev.d.ts +1 -1
- package/dist/packages/projenio.d.ts +1 -1
- package/dist/packages/projorg.d.ts +1 -1
- package/dist/packages/pulumiio.d.ts +1 -1
- package/dist/packages/pygmentsorg.d.ts +1 -1
- package/dist/packages/railwayapp.d.ts +1 -1
- package/dist/packages/rapidjsonorg.d.ts +1 -1
- package/dist/packages/rcloneorg.d.ts +1 -1
- package/dist/packages/re2corg.d.ts +1 -1
- package/dist/packages/rectangleapp.d.ts +1 -1
- package/dist/packages/rendercom.d.ts +1 -1
- package/dist/packages/replibytecom.d.ts +1 -1
- package/dist/packages/rhashsourceforgenet.d.ts +1 -1
- package/dist/packages/riotermcom.d.ts +1 -1
- package/dist/packages/rubocoporg.d.ts +1 -1
- package/dist/packages/rubygemsorg.d.ts +1 -1
- package/dist/packages/runatlantisio.d.ts +1 -1
- package/dist/packages/s3toolsorg.d.ts +1 -1
- package/dist/packages/scalewaycom.d.ts +1 -1
- package/dist/packages/sdkmanio.d.ts +1 -1
- package/dist/packages/seaweedfscom.d.ts +1 -1
- package/dist/packages/sentryio.d.ts +1 -1
- package/dist/packages/shellchecknet.d.ts +1 -1
- package/dist/packages/skaffolddev.d.ts +1 -1
- package/dist/packages/sniffnetnet.d.ts +1 -1
- package/dist/packages/soldeerxyz.d.ts +1 -1
- package/dist/packages/soliditylangorg.d.ts +1 -1
- package/dist/packages/sqlcdev.d.ts +1 -1
- package/dist/packages/sqlfluffcom.d.ts +1 -1
- package/dist/packages/squawkhqcom.d.ts +1 -1
- package/dist/packages/starshiprs.d.ts +1 -1
- package/dist/packages/statsapp.d.ts +1 -1
- package/dist/packages/steampipeio.d.ts +1 -1
- package/dist/packages/straceio.d.ts +1 -1
- package/dist/packages/streamlinkgithubio.d.ts +1 -1
- package/dist/packages/stripecom.d.ts +1 -1
- package/dist/packages/surrealdbcom.d.ts +1 -1
- package/dist/packages/swiftorg.d.ts +1 -1
- package/dist/packages/symfonycom.d.ts +1 -1
- package/dist/packages/sympyorg.d.ts +1 -1
- package/dist/packages/syncthingnet.d.ts +1 -1
- package/dist/packages/tailscalecom.d.ts +1 -1
- package/dist/packages/tailwindcsscom.d.ts +1 -1
- package/dist/packages/tartrun.d.ts +1 -1
- package/dist/packages/taskfiledev.d.ts +1 -1
- package/dist/packages/teaxyz.d.ts +1 -1
- package/dist/packages/terraformio.d.ts +1 -1
- package/dist/packages/terragruntgruntworkio.d.ts +1 -1
- package/dist/packages/terratagio.d.ts +1 -1
- package/dist/packages/tiltdev.d.ts +1 -1
- package/dist/packages/tinygoorg.d.ts +1 -1
- package/dist/packages/tldrsh.d.ts +1 -1
- package/dist/packages/toxwiki.d.ts +1 -1
- package/dist/packages/traefikio.d.ts +1 -1
- package/dist/packages/tursotech.d.ts +1 -1
- package/dist/packages/typescriptlangorg.d.ts +1 -1
- package/dist/packages/uriparsergithubio.d.ts +1 -1
- package/dist/packages/vapoursynthcom.d.ts +1 -1
- package/dist/packages/vaultprojectio.d.ts +1 -1
- package/dist/packages/vclustercom.d.ts +1 -1
- package/dist/packages/wailsio.d.ts +1 -1
- package/dist/packages/wasmerio.d.ts +1 -1
- package/dist/packages/watchexecgithubio.d.ts +1 -1
- package/dist/packages/wavpackcom.d.ts +1 -1
- package/dist/packages/werfio.d.ts +1 -1
- package/dist/packages/xcfiledev.d.ts +1 -1
- package/dist/packages/xkbcommonorg.d.ts +1 -1
- package/dist/packages/xtlsgithubio.d.ts +1 -1
- package/dist/packages/zarfdev.d.ts +1 -1
- package/dist/packages/zeddev.d.ts +1 -1
- package/dist/packages/zeromqorg.d.ts +1 -1
- package/dist/packages/ziglangorg.d.ts +3 -3
- package/dist/packages/zotregistrydev.d.ts +1 -1
- package/dist/packages/zrokio.d.ts +1 -1
- package/dist/pantry-api.d.ts +1 -0
- package/dist/src/index.js +1 -1
- package/dist/testing/index.d.ts +3 -0
- package/package.json +3 -4
- package/dist/chunk-b4krz2vb.js +0 -2
- package/dist/chunk-d7470145.js +0 -2
- package/dist/chunk-ehawm227.js +0 -275
- package/dist/chunk-f0qhrqsj.js +0 -2
- package/dist/chunk-fejavkhf.js +0 -1
- package/dist/chunk-fptwe9k9.js +0 -11
- package/dist/chunk-g3ex932z.js +0 -1
- package/dist/chunk-pjsw4rfb.js +0 -1
- package/dist/chunk-q0dw6bcf.js +0 -142
- package/dist/chunk-y15ydasq.js +0 -42
- package/scripts/pantry-cli.ts +0 -319
package/dist/chunk-fejavkhf.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Cb as b,Db as c,Fb as d}from"./chunk-f0qhrqsj.js";import{Gb as a}from"./chunk-5y0crbzc.js";import"./chunk-c1hyjq5h.js";d();export{b as pantry,c as packages,a as aliases};
|
package/dist/chunk-fptwe9k9.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{Gb as y,Hb as H}from"./chunk-5y0crbzc.js";import{Ob as E}from"./chunk-c1hyjq5h.js";H();import x from"node:fs";import S from"node:path";import A from"node:process";var O=S.join(A.cwd(),"github-rate-limit.json"),w=S.join(A.cwd(),"github-cache.json"),R=10,W=3600000;function F(X){try{let J=X.get("X-RateLimit-Remaining"),$=X.get("X-RateLimit-Reset"),Z=X.get("X-RateLimit-Limit");if(J&&$&&Z){let V=new Date(Number($)*1000),Y={remaining:Number(J),limit:Number(Z),resetTime:V.toISOString(),resetTimestamp:Number($)*1000,lastUpdated:new Date().toISOString()};x.writeFileSync(O,JSON.stringify(Y,null,2)),console.warn(`GitHub API rate limit info saved to ${O}`),console.warn(`Rate limit: ${J}/${Z} remaining, resets at ${V.toLocaleString()}`)}}catch(J){console.error("Failed to save GitHub rate limit info:",J)}}function M(){try{if(!x.existsSync(O))return!0;let X=JSON.parse(x.readFileSync(O,"utf8")),J=Date.now();if(J>=X.resetTimestamp)return!0;if(X.remaining<=R){let $=new Date(X.resetTimestamp);console.warn(`GitHub API rate limit almost exhausted (${X.remaining}/${X.limit} remaining). Preserving remaining calls until reset at ${$.toLocaleString()}`);let Z=X.resetTimestamp-J;if(Z<300000)console.error(`Waiting ${Math.round(Z/1000)} seconds for rate limit to reset...`);return!1}return!0}catch(X){return console.error("Error checking GitHub rate limit:",X),!0}}function T(){try{if(!x.existsSync(w))return null;let X=JSON.parse(x.readFileSync(w,"utf8")),J=Date.now();if(X.timestamp&&J-X.timestamp<W){let $=new Date(X.timestamp+W);if(console.error(`Using GitHub API cache from ${new Date(X.timestamp).toLocaleString()}, expires at ${$.toLocaleString()}`),Array.isArray(X.packages))return console.error(`Using ${X.packages.length} packages from GitHub API cache`),X.packages;else if(Array.isArray(X.data))return console.error(`Using ${X.data.length} packages from GitHub API cache (old format)`),X.data;else return console.error("GitHub API cache has invalid format, fetching fresh data"),null}return console.error(`GitHub API cache expired (older than ${W/1000/60} minutes), fetching fresh data`),null}catch(X){return console.error("Error reading GitHub cache:",X),null}}function U(X){try{let J={timestamp:Date.now(),packages:X};x.writeFileSync(w,JSON.stringify(J,null,2)),console.error(`GitHub API package list cached to ${w} (${X.length} packages)`)}catch(J){console.error("Error saving GitHub cache:",J)}}async function k(X=0,J){if(J){if(J.startsWith("/")||J.includes("/bin/"))return console.error(`Error: '${J}' appears to be a path, not a valid package name.`),[];return console.log(`Single package mode: only fetching '${J}'`),[J]}console.log("Fetching package list from GitHub API...");let $=T();if($)return console.log("Using cached package list, no GitHub API calls needed"),X>0?$.slice(0,X):$;try{if(!M()){console.warn("GitHub API rate limit preventing request - using cached data or hardcoded list");let z=["node","bun.sh","python.org","go.dev","rust-lang.org","deno.land","ruby-lang.org","php.net","dart.dev","postgresql.org","mozilla.org","mysql.com","nginx.org","redis.io","mongodb.com"];return U(z),X>0?z.slice(0,X):z}console.error("No valid cache found, making GitHub API requests");let Z=await fetch("https://api.github.com/repos/pkgxdev/pantry/contents/projects",{headers:{Accept:"application/vnd.github.v3+json","User-Agent":"ts-pantry"}});if(F(Z.headers),!Z.ok)throw Error(`GitHub API responded with ${Z.status}: ${Z.statusText}`);let Y=(await Z.json()).filter((z)=>z.type==="dir").map((z)=>z.name);console.error(`Found ${Y.length} base projects on GitHub`);let q=[...Y],K=["agwa.name","acorn.io","apache.org","aquasecurity.github.io","aws.amazon.com"],C=["alsa-project.org/alsa-lib","apple.com/remote_cmds","android.com/cmdline-tools","anchore.com/syft","argoproj.github.io/cd","argoproj.github.io/workflows","amrdeveloper.github.io/GQL","authzed.com/spicedb","arduino.github.io/arduino-cli","aomedia.googlesource.com/aom","akuity.io/kargo","asciinema.org/agg","ansible.com/ansible-lint","astral.sh/ruff","astral.sh/uv","apollographql.com/rover","brxken128.github.io/dexios","cedarpolicy.com/cli","blake2.net/libb2"];for(let z of K){if(!M()){console.error(`Skipping nested path check for ${z} due to rate limit concerns`);continue}try{console.error(`Checking for nested projects in ${z}...`);let Q=await fetch(`https://api.github.com/repos/pkgxdev/pantry/contents/projects/${z}`,{headers:{Accept:"application/vnd.github.v3+json","User-Agent":"ts-pantry"}});if(F(Q.headers),!Q.ok){console.error(`Failed to fetch nested projects for ${z}: ${Q.status}`);continue}let B=(await Q.json()).filter((v)=>v.type==="dir").map((v)=>`${z}/${v.name}`);console.error(`Found ${B.length} nested projects for ${z}: ${B.join(", ")}`),q.push(...B)}catch(Q){console.error(`Error fetching nested projects for ${z}:`,Q)}}for(let z of C)if(!q.includes(z))console.error(`Adding known nested project: ${z}`),q.push(z);U(q),console.error(`Cached ${q.length} packages for future use (valid for ${W/60000} minutes)`);let D=X>0?q.slice(0,X):q;return console.error(`Total of ${q.length} projects found (including nested paths)`),D}catch(Z){return console.error("Error fetching package list from GitHub:",Z),[]}}async function b(){try{let{fetchPkgxProjects:X}=await import("./chunk-8f13z8n1.js"),J=await X();if(console.error(`Found ${J.length} projects`),J.length>0){if(console.error("First 10 projects:"),J.slice(0,10).forEach(($)=>{console.error(`- ${$.name}`)}),J.length>10)console.error(`... and ${J.length-10} more`)}return J}catch(X){return console.error("Failed to fetch projects:",X),[]}}function G(X,J=2){if(X===null)return"null";if(X===void 0)return"undefined";if(Array.isArray(X)){if(X.length===0)return"[]";if(X.every((Z)=>typeof Z==="string")){if(X.length===1)return`[${JSON.stringify(X[0])}]`;let Z=X.map((V)=>JSON.stringify(V)).join(`,
|
|
2
|
-
${" ".repeat(J)}`);return`[
|
|
3
|
-
${" ".repeat(J)}${Z}
|
|
4
|
-
${" ".repeat(J-2)}]`}let $=X.map((Z)=>G(Z,J+2)).join(`,
|
|
5
|
-
${" ".repeat(J+2)}`);return`[
|
|
6
|
-
${" ".repeat(J+2)}${$}
|
|
7
|
-
${" ".repeat(J)}]`}if(typeof X==="object")return`{
|
|
8
|
-
${Object.entries(X).map(([Z,V])=>{let Y=typeof V==="string"?JSON.stringify(V):G(V,J+2);return`${" ".repeat(J)}${Z}: ${Y}`}).join(`,
|
|
9
|
-
`)}
|
|
10
|
-
}`;return String(X)}function g(X){if(X.includes("/")){let J=X.split("/"),$=J[0],Z=J.slice(1),V=$.replace(/[.-]/g,""),Y=Z.map((K)=>K.replace(/[.-]/g,"")),q="";if(Y.length>0){let K=Y[0];if(V.includes(K.toLowerCase()))q="";else if(Y.length===1)q=K;else q=K}return`${V}${q}`.toLowerCase()}return X.replace(/[.-]/g,"").toLowerCase()}function j(X){if(X.includes("/")){let[J,$]=X.split("/"),Z=J.replace(/\./g,""),V=$.replace(/\//g,"-");return`${Z}-${V}`.toLowerCase()}return X.replace(/\./g,"").toLowerCase()}function p(X){if(X.includes("-")){let $=X.indexOf("-"),Z=X.substring(0,$),V=X.substring($+1),Y=Z;if(Y.endsWith("org")&&!Y.endsWith(".org"))Y=Y.replace(/org$/,".org");if(Y.endsWith("io")&&!Y.endsWith(".io"))Y=Y.replace(/io$/,".io");if(Y.endsWith("com")&&!Y.endsWith(".com"))Y=Y.replace(/com$/,".com");if(Y.endsWith("sh")&&!Y.endsWith(".sh"))Y=Y.replace(/sh$/,".sh");if(Y.endsWith("dev")&&!Y.endsWith(".dev"))Y=Y.replace(/dev$/,".dev");if(Y.endsWith("net")&&!Y.endsWith(".net"))Y=Y.replace(/net$/,".net");if(Y.endsWith("name")&&!Y.endsWith(".name"))Y=Y.replace(/name$/,".name");return`${Y}/${V}`}let J=X;if(J.endsWith("org")&&!J.endsWith(".org"))J=J.replace(/org$/,".org");if(J.endsWith("io")&&!J.endsWith(".io"))J=J.replace(/io$/,".io");if(J.endsWith("com")&&!J.endsWith(".com"))J=J.replace(/com$/,".com");if(J.endsWith("sh")&&!J.endsWith(".sh"))J=J.replace(/sh$/,".sh");if(J.endsWith("dev")&&!J.endsWith(".dev"))J=J.replace(/dev$/,".dev");if(J.endsWith("net")&&!J.endsWith(".net"))J=J.replace(/net$/,".net");if(J.endsWith("land")&&!J.endsWith(".land"))J=J.replace(/land$/,".land");return J}function N(X){let[J]=X.split("@");if(y[J])return y[J];if(J.includes("."))return J;return`${J}.org`}function P(){return{...y}}function h(X){let[J]=X.split("@");return J in y}function l(X){return N(X)}
|
|
11
|
-
export{F as Ya,M as Za,T as _a,U as $a,k as ab,b as bb,G as cb,g as db,j as eb,p as fb,N as gb,P as hb,h as ib,l as jb};
|
package/dist/chunk-g3ex932z.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{kb as a,lb as b,mb as c,nb as d,ob as e}from"./chunk-d7470145.js";import"./chunk-c1hyjq5h.js";export{d as PACKAGE_ALIASES,c as DEFAULT_TIMEOUT_MS,b as DEFAULT_CACHE_EXPIRATION_MINUTES,a as DEFAULT_CACHE_DIR,e as ALL_KNOWN_PACKAGES};
|
package/dist/chunk-pjsw4rfb.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Aa as a,Ba as b,Ca as c,Da as d,Ea as e,Fa as f,Ga as g,Ha as h,Ia as i,Ja as j}from"./chunk-2kx0m76s.js";import"./chunk-c1hyjq5h.js";export{j as updateApp,g as scanInstalledApps,h as queryBrewCaskVersions,d as isNewerVersion,e as guessCaskToken,f as getCaskToken,i as checkAppUpdates,b as SYSTEM_APPS,c as MAS_APPS,a as APP_CASK_MAP};
|
package/dist/chunk-q0dw6bcf.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import{Ib as R,Jb as T}from"./chunk-r54nadvd.js";import"./chunk-c1hyjq5h.js";import E from"node:fs";import I from"node:path";function z(j,J){let L=R(j);if(L.length===0)return J;if(T(j))return L;return[...new Set([...J,...L])]}function O(j){let J=[],L=E.readdirSync(j,{withFileTypes:!0});for(let w of L){let Q=I.join(j,w.name);if(w.isDirectory())J.push(...O(Q));else if(w.isFile()&&w.name.endsWith(".ts")&&w.name!=="index.ts"&&w.name!=="aliases.ts")J.push(Q)}return J}function C(j,J){let L=j.startsWith("v")?j.slice(1):j,w=J.startsWith("v")?J.slice(1):J,Q=L.split(/[.-]/),W=w.split(/[.-]/);for(let q=0;q<Math.max(Q.length,W.length);q++){let K=Q[q]||"0",X=W[q]||"0",_=Number.parseInt(K,10),$=Number.parseInt(X,10);if(!Number.isNaN(_)&&!Number.isNaN($)){if(_>$)return-1;if(_<$)return 1}else{if(K>X)return-1;if(K<X)return 1}}return 0}function Y(j){return j.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function V(j){let J=j.programs.map((q)=>`"${Y(q)}"`).join(", "),L=j.dependencies.map((q)=>`"${Y(q)}"`).join(", "),w=j.buildDependencies.map((q)=>`"${Y(q)}"`).join(", "),Q=j.aliases.map((q)=>`"${Y(q)}"`).join(", "),W=j.versions.map((q)=>`"${Y(q)}"`).join(", ");return` .{
|
|
2
|
-
.name = "${Y(j.name)}",
|
|
3
|
-
.domain = "${Y(j.domain)}",
|
|
4
|
-
.description = "${Y(j.description)}",
|
|
5
|
-
.homepage_url = ${j.homepageUrl?`"${Y(j.homepageUrl)}"`:"null"},
|
|
6
|
-
.programs = &[_][]const u8{ ${J} },
|
|
7
|
-
.dependencies = &[_][]const u8{ ${L} },
|
|
8
|
-
.build_dependencies = &[_][]const u8{ ${w} },
|
|
9
|
-
.aliases = &[_][]const u8{ ${Q} },
|
|
10
|
-
.versions = &[_][]const u8{ ${W} },
|
|
11
|
-
}`}async function v(j,J){console.log(`\uD83D\uDD0D Scanning packages directory: ${j}`);let L=O(j);console.log(`\uD83D\uDCE6 Found ${L.length} package files`);let w=[],Q=0,W=0;for(let K of L)try{let _=E.readFileSync(K,"utf-8").match(/export const (\w+) = \{/);if(!_){console.warn(`⚠️ Could not find export const in ${K}`),W++;continue}let H=(await import(`file://${I.resolve(K)}`))[_[1]];if(!H||!H.domain){console.warn(`⚠️ Invalid package data in ${K}`),W++;continue}let G=Array.isArray(H.versions)?[...H.versions].sort(C):[];if(w.push({name:H.name||H.domain,domain:H.domain,description:H.description||"",homepageUrl:H.homepageUrl,programs:Array.isArray(H.programs)?H.programs:[],dependencies:Array.isArray(H.dependencies)?H.dependencies:[],buildDependencies:Array.isArray(H.buildDependencies)?H.buildDependencies:[],aliases:z(H.domain,Array.isArray(H.aliases)?H.aliases:[]),versions:G}),Q++,Q%100===0)console.log(` Processed ${Q}/${L.length} packages...`)}catch(X){console.error(`❌ Error processing ${K}:`,X),W++}console.log(`✅ Processed ${Q} packages (${W} errors)`),w.sort((K,X)=>K.domain.localeCompare(X.domain));let q=N(w);E.writeFileSync(J,q,"utf-8"),console.log(`✅ Generated Zig definitions: ${J}`),console.log(`\uD83D\uDCCA Total packages: ${w.length}`)}function N(j){let J=j.map((L)=>V(L)).join(`,
|
|
12
|
-
`);return`//! Package definitions generated from ts-pantry
|
|
13
|
-
//! DO NOT EDIT MANUALLY - This file is auto-generated
|
|
14
|
-
//! Generated on: ${new Date().toISOString()}
|
|
15
|
-
//! Total packages: ${j.length}
|
|
16
|
-
|
|
17
|
-
const std = @import("std");
|
|
18
|
-
|
|
19
|
-
/// Package information
|
|
20
|
-
pub const PackageInfo = struct {
|
|
21
|
-
name: []const u8,
|
|
22
|
-
domain: []const u8,
|
|
23
|
-
description: []const u8,
|
|
24
|
-
homepage_url: ?[]const u8,
|
|
25
|
-
programs: []const []const u8,
|
|
26
|
-
dependencies: []const []const u8,
|
|
27
|
-
build_dependencies: []const []const u8,
|
|
28
|
-
aliases: []const []const u8,
|
|
29
|
-
versions: []const []const u8,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
/// All known packages (${j.length} total)
|
|
33
|
-
pub const packages = [_]PackageInfo{
|
|
34
|
-
${J}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/// Get package by domain name
|
|
38
|
-
pub fn getPackageByDomain(domain: []const u8) ?*const PackageInfo {
|
|
39
|
-
for (&packages) |*pkg| {
|
|
40
|
-
if (std.mem.eql(u8, pkg.domain, domain)) {
|
|
41
|
-
return pkg;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/// Get package by name (checks domain and aliases)
|
|
48
|
-
pub fn getPackageByName(name: []const u8) ?*const PackageInfo {
|
|
49
|
-
for (&packages) |*pkg| {
|
|
50
|
-
// Check domain
|
|
51
|
-
if (std.mem.eql(u8, pkg.domain, name)) {
|
|
52
|
-
return pkg;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Check full name
|
|
56
|
-
if (std.mem.eql(u8, pkg.name, name)) {
|
|
57
|
-
return pkg;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Check aliases
|
|
61
|
-
for (pkg.aliases) |alias| {
|
|
62
|
-
if (std.mem.eql(u8, alias, name)) {
|
|
63
|
-
return pkg;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/// Get all package domains
|
|
71
|
-
pub fn getAllDomains(allocator: std.mem.Allocator) ![][]const u8 {
|
|
72
|
-
// eslint-disable-next-line prefer-const
|
|
73
|
-
var domains = try allocator.alloc([]const u8, packages.len);
|
|
74
|
-
for (packages, 0..) |pkg, i| {
|
|
75
|
-
domains[i] = pkg.domain;
|
|
76
|
-
}
|
|
77
|
-
return domains;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/// Get total package count
|
|
81
|
-
pub fn getPackageCount() usize {
|
|
82
|
-
return packages.len;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
test "Package registry has entries" {
|
|
86
|
-
try std.testing.expect(packages.len > 0);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
test "Can find node package" {
|
|
90
|
-
const node = getPackageByName("node");
|
|
91
|
-
if (node) |pkg| {
|
|
92
|
-
try std.testing.expectEqualStrings("nodejs.org", pkg.domain);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
test "Can find package by domain" {
|
|
97
|
-
const node = getPackageByDomain("nodejs.org");
|
|
98
|
-
try std.testing.expect(node != null);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
test "Can find package by alias" {
|
|
102
|
-
const bun = getPackageByName("bun");
|
|
103
|
-
if (bun) |pkg| {
|
|
104
|
-
try std.testing.expect(
|
|
105
|
-
std.mem.eql(u8, pkg.domain, "bun.sh") or
|
|
106
|
-
std.mem.eql(u8, pkg.domain, "bun.com")
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
`}async function B(j,J){console.log(`\uD83D\uDD0D Generating Zig aliases from: ${j}`);let L=O(j),w={};for(let q of L)try{let X=E.readFileSync(q,"utf-8").match(/export const (\w+) = \{/);if(!X)continue;let U=(await import(`file://${I.resolve(q)}`))[X[1]];if(!U||!U.domain)continue;if(U.aliases&&Array.isArray(U.aliases))for(let G of U.aliases)w[G]=U.domain;if(U.name&&U.name!==U.domain)w[U.name]=U.domain;let H=U.domain.split(".")[0];if(H&&!w[H])w[H]=U.domain}catch(K){console.error(`Error processing ${q}:`,K)}let Q=Object.entries(w).sort(([q],[K])=>q.localeCompare(K)).map(([q,K])=>` .{ .alias = "${Y(q)}", .domain = "${Y(K)}" }`).join(`,
|
|
111
|
-
`),W=`//! Package aliases generated from ts-pantry
|
|
112
|
-
//! DO NOT EDIT MANUALLY - This file is auto-generated
|
|
113
|
-
//! Generated on: ${new Date().toISOString()}
|
|
114
|
-
|
|
115
|
-
const std = @import("std");
|
|
116
|
-
|
|
117
|
-
pub const Alias = struct {
|
|
118
|
-
alias: []const u8,
|
|
119
|
-
domain: []const u8,
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
pub const aliases = [_]Alias{
|
|
123
|
-
${Q}
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
/// Resolve an alias to a domain name
|
|
127
|
-
pub fn resolvealias(alias: []const u8) ?[]const u8 {
|
|
128
|
-
for (aliases) |entry| {
|
|
129
|
-
if (std.mem.eql(u8, entry.alias, alias)) {
|
|
130
|
-
return entry.domain;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
test "Alias resolution works" {
|
|
137
|
-
const resolved = resolvealias("node");
|
|
138
|
-
if (resolved) |domain| {
|
|
139
|
-
try std.testing.expectEqualStrings("nodejs.org", domain);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
`;E.writeFileSync(J,W,"utf-8"),console.log(`✅ Generated Zig aliases: ${J}`),console.log(`\uD83D\uDCCA Total aliases: ${Object.keys(w).length}`)}export{v as generateZigDefinitions,B as generateZigAliases};
|
package/dist/chunk-y15ydasq.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import{kb as k,lb as c,mb as p}from"./chunk-d7470145.js";import{Gb as h,Hb as GQ}from"./chunk-5y0crbzc.js";import{Ib as $Q,Jb as qQ}from"./chunk-r54nadvd.js";import{Ob as QQ}from"./chunk-c1hyjq5h.js";import H from"node:fs";import w from"node:path";import I from"node:process";GQ();var JQ=async(...Q)=>null;function m(Q,K){let G=Q.replace(/^v/,"").split("."),$=K.replace(/^v/,"").split(".");for(let q=0;q<Math.max(G.length,$.length);q++){let Z=Number.parseInt(G[q]||"0",10),X=Number.parseInt($[q]||"0",10);if(!Number.isNaN(Z)&&!Number.isNaN(X)){if(Z!==X)return X-Z}else{let Y=($[q]||"").localeCompare(G[q]||"");if(Y!==0)return Y}}return 0}function a(Q){if(Q.includes("/")){let[K,...G]=Q.split("/"),$=G.join("/"),q=K.replace(/\./g,"");if(K.includes("github.com")){let X=$.split("/");return X[X.length-1].replace(/[.-]/g,"").toLowerCase()}let Z=$.replace(/[/.-]/g,"");return`${q}${Z}`.toLowerCase()}return Q.replace(/\./g,"").toLowerCase()}function YQ(Q,K){switch(Q){case"versions":if(Array.isArray(K)&&K.length>0)return` /**
|
|
2
|
-
* Available versions from newest to oldest.
|
|
3
|
-
* @see https://ts-pantry.netlify.app/usage for installation instructions
|
|
4
|
-
*/`;break;case"programs":if(Array.isArray(K)&&K.length>0)return` /**
|
|
5
|
-
* Executable programs provided by this package.
|
|
6
|
-
* These can be run after installation.
|
|
7
|
-
*/`;break;case"dependencies":if(Array.isArray(K)&&K.length>0)return` /**
|
|
8
|
-
* Runtime dependencies for this package.
|
|
9
|
-
* These are required when running the package.${K.some((q)=>typeof q==="string"&&q.includes(":"))?"\n * OS-specific dependencies are prefixed with `os:` (e.g., `linux:freetype.org`).":""}
|
|
10
|
-
*/`;break;case"buildDependencies":if(Array.isArray(K)&&K.length>0)return` /**
|
|
11
|
-
* Build dependencies for this package.
|
|
12
|
-
* These are only required when building the package from source.${K.some((q)=>typeof q==="string"&&q.includes(":"))?"\n * OS-specific dependencies are prefixed with `os:` (e.g., `linux:gnu.org/gcc`).":""}
|
|
13
|
-
*/`;break;case"companions":if(Array.isArray(K)&&K.length>0)return` /**
|
|
14
|
-
* Related packages that work well with this package.
|
|
15
|
-
* Consider installing these for enhanced functionality.
|
|
16
|
-
*/`;break;case"aliases":if(Array.isArray(K)&&K.length>0)return` /**
|
|
17
|
-
* Alternative names for this package.
|
|
18
|
-
* You can use any of these names to access the package.
|
|
19
|
-
*/`;break;case"installCommand":return` /**
|
|
20
|
-
* Command to install this package using pantry.
|
|
21
|
-
* @example pantry install package-name
|
|
22
|
-
*/`;case"description":return` /**
|
|
23
|
-
* Brief description of what this package does.
|
|
24
|
-
*/`;case"domain":return` /**
|
|
25
|
-
* The canonical domain name for this package.
|
|
26
|
-
*/`;case"name":return` /**
|
|
27
|
-
* The display name of this package.
|
|
28
|
-
*/`;default:return null}return null}function ZQ(Q){let K=[];K.push("{");for(let[G,$]of Object.entries(Q)){if(G==="fetchedAt")continue;let q=YQ(G,$);if(q)K.push(q);if($===void 0){K.push(` ${G}: undefined,`);continue}if(Array.isArray($))if($.length===0)K.push(` ${G}: [] as const,`);else if(typeof $[0]==="string"){let Z=$;if(G==="aliases"){let X=Q.name;Z=$.filter((Y)=>{if(Y.includes("--")||Y.includes("$SHELL")||Y.includes("+")||Y.includes("(")||Y.includes(")"))return!1;if(Y===X)return!1;return!0})}if(Z.length===0)K.push(` ${G}: [] as const,`);else{K.push(` ${G}: [`);for(let X of Z)K.push(` '${String(X).replace(/'/g,"\\'")}',`);K.push(" ] as const,")}}else{let Z=JSON.stringify($).replace(/"/g,"'");K.push(` ${G}: ${Z} as const,`)}else if(typeof $==="string")K.push(` ${G}: '${String($).replace(/'/g,"\\'")}' as const,`);else if(typeof $==="number"||typeof $==="boolean")K.push(` ${G}: ${$} as const,`);else if($===null)K.push(` ${G}: null,`);else if(typeof $==="object")K.push(` ${G}: ${ZQ($)},`);else{let Z=JSON.stringify($).replace(/"/g,"'");K.push(` ${G}: ${Z},`)}}return K.push("}"),K.join(`
|
|
29
|
-
`)}function WQ(Q,K,G){let $=[];if($.push("/**"),Q.description)$.push(` * **${G}** - ${Q.description.trim()}`);else $.push(` * **${G}** - pkgx package`);if($.push(" *"),$.push(` * @domain \`${Q.domain||K}\``),Q.programs&&Q.programs.length>0){let q=Q.programs.slice(0,5).join("`, `"),Z=Q.programs.length>5?`, ... (+${Q.programs.length-5} more)`:"";$.push(` * @programs \`${q}\`${Z}`)}if(Q.versions&&Q.versions.length>0)$.push(` * @version \`${Q.versions[0]}\` (${Q.versions.length} versions available)`),$.push(" * @versions From newest version to oldest.");if(Q.installCommand)$.push(" *"),$.push(` * @install \`${Q.installCommand}\``);if(Q.aliases&&Q.aliases.length>0){let q=Q.aliases.filter((Z)=>{return!Z.includes("--")&&!Z.includes("$SHELL")&&!Z.includes("+")&&!Z.includes("(")&&!Z.includes(")")});if(q.length>0){let Z=Q.name,X=q.filter((W)=>W!==Z),Y=q.find((W)=>W===Z);if(Y)$.push(` * @name \`${Y}\``);if(X.length>0)$.push(` * @aliases ${X.map((W)=>`\`${W}\``).join(", ")}`)}}if(Q.homepageUrl)$.push(` * @homepage ${Q.homepageUrl}`);if(Q.dependencies&&Q.dependencies.length>0){let q=Q.dependencies.slice(0,3).join("`, `"),Z=Q.dependencies.length>3?`, ... (+${Q.dependencies.length-3} more)`:"",Y=Q.dependencies.some((W)=>W.includes(":"))?" (includes OS-specific dependencies with `os:package` format)":"";$.push(` * @dependencies \`${q}\`${Z}${Y}`)}if(Q.buildDependencies&&Q.buildDependencies.length>0){let q=Q.buildDependencies.slice(0,3).join("`, `"),Z=Q.buildDependencies.length>3?`, ... (+${Q.buildDependencies.length-3} more)`:"",Y=Q.buildDependencies.some((W)=>W.includes(":"))?" (includes OS-specific dependencies with `os:package` format)":"";$.push(` * @buildDependencies \`${q}\`${Z}${Y} - required only when building from source`)}if(Q.companions&&Q.companions.length>0){let q=Q.companions.slice(0,3).join("`, `"),Z=Q.companions.length>3?`, ... (+${Q.companions.length-3} more)`:"";$.push(` * @companions \`${q}\`${Z}`)}if($.push(" *"),$.push(" * @example"),$.push(" * ```typescript"),$.push(" * import { pantry } from 'ts-pantry'"),$.push(" *"),Q.aliases&&Q.aliases.length>0){let q=Q.aliases.find((Z)=>{return!Z.includes("--")&&!Z.includes("$SHELL")&&!Z.includes("+")&&!Z.includes("(")&&!Z.includes(")")});if(q){let Z=q.replace(/[^a-z0-9]/gi,""),X=K.replace(/[.-]/g,"").replace(/\//g,"").toLowerCase();if(q===Q.name)$.push(" * // Access the package"),$.push(` * const pkg = pantry.${Z}`),$.push(" * // Or access via domain"),$.push(` * const samePkg = pantry.${X}`),$.push(" * console.log(pkg === samePkg) // true");else $.push(" * // Access via alias (recommended)"),$.push(` * const pkg = pantry.${Z}`),$.push(" * // Or access via domain"),$.push(` * const samePkg = pantry.${X}`),$.push(" * console.log(pkg === samePkg) // true")}else{let Z=K.replace(/[.-]/g,"").replace(/\//g,"").toLowerCase();$.push(` * const pkg = pantry.${Z}`)}}else{let q=K.replace(/[.-]/g,"").replace(/\//g,"").toLowerCase();$.push(` * const pkg = pantry.${q}`)}if($.push(` * console.log(pkg.name) // "${Q.name||G}"`),Q.description){let q=Q.description.length>50?`${Q.description.substring(0,47)}...`:Q.description;$.push(` * console.log(pkg.description) // "${q}"`)}if(Q.programs&&Q.programs.length>0)$.push(` * console.log(pkg.programs) // [${Q.programs.slice(0,2).map((q)=>`"${q}"`).join(", ")}${Q.programs.length>2?", ...":""}]`);if(Q.versions&&Q.versions.length>0)$.push(` * console.log(pkg.versions[0]) // "${Q.versions[0]}" (latest)`);return $.push(" * ```"),$.push(" *"),$.push(` * @see https://ts-pantry.netlify.app/packages/${K.replace(/\./g,"-")}.md`),$.push(" * @see https://ts-pantry.netlify.app/usage"),$.push(" */"),$.join(`
|
|
30
|
-
`)}function zQ(Q,K){function G(W){if(!W||W.length<2)return!1;if(W.includes("--")||W.includes("$SHELL")||W.includes("+")||W.includes("(")||W.includes(")"))return!1;if(["cli","app","tool","server","client","api","lib","core"].includes(W.toLowerCase()))return!1;if(/^[\d.]+$/.test(W)&&/^\d/.test(W))return!1;return!0}let $,q;if(K==="classic.yarnpkg.com")$="classicYarnPackage",q="yarn";else if(K==="yarnpkg.com")$="yarnPackage",q="yarn";else if(Q.aliases&&Q.aliases.length>0){let W=Q.aliases.find((J)=>G(J));if(W){let J=W.replace(/[^a-z0-9]/gi,"");$=`${J.charAt(0).toLowerCase()}${J.slice(1)}Package`,q=W}else $=`${a(K)}Package`,q=Q.name||K}else $=`${a(K)}Package`,q=Q.name||K;let Z=$.replace(/[^\w$]/g,""),X=WQ(Q,K,q),Y=ZQ(Q);return`${X}
|
|
31
|
-
export const ${Z} = ${Y}
|
|
32
|
-
|
|
33
|
-
export type ${Z.charAt(0).toUpperCase()+Z.slice(1)} = typeof ${Z}
|
|
34
|
-
`}function r(Q){let K=Q.replace(/\{\{[^}]*\}\}/g,"").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"");if(!K||K.length===0)return"package";let G=K.replace(/[^\w.-]/g,"-");if(G.length>200)G=`${G.substring(0,150)}...${G.substring(G.length-45)}`;return G}function N(Q,K,G){if(!H.existsSync(Q))H.mkdirSync(Q,{recursive:!0});let $;if(K.includes("/")){let X=K.split("/"),Y=X[0],W=X.slice(1),J=w.join(Q,Y,...W.slice(0,-1));if(!H.existsSync(J))H.mkdirSync(J,{recursive:!0});let B=r(W[W.length-1]);$=w.join(J,`${B}.ts`)}else{let X=K.replace(/\./g,"");$=w.join(Q,`${X}.ts`)}let q={...G};delete q.fetchedAt;let Z=zQ(q,K);return H.writeFileSync($,Z),$}function AQ(Q,K){if(!H.existsSync(Q))return[];let G=new Set;for(let X of K)if(X.includes("/")){let Y=X.split("/"),W=Y[0],J=Y.slice(1),B=r(J[J.length-1]);G.add(w.resolve(Q,W,...J.slice(0,-1),`${B}.ts`))}else{let Y=X.replace(/\./g,"");G.add(w.resolve(Q,`${Y}.ts`))}let $=new Set(["index.ts","aliases.ts","types.ts"]),q=[];function Z(X){if(!H.existsSync(X))return;for(let Y of H.readdirSync(X,{withFileTypes:!0})){let W=w.join(X,Y.name);if(Y.isDirectory()){if(Z(W),H.existsSync(W)&&H.readdirSync(W).length===0)H.rmdirSync(W)}else if(Y.name.endsWith(".ts")&&!$.has(Y.name)){if(!G.has(w.resolve(W)))H.unlinkSync(W),q.push(W)}}}return Z(Q),q}function _Q(Q,K={}){try{let G=K.cacheDir||k;if(K.cache===!1)return console.log(`Cache disabled for ${Q}, skipping cache check`),null;let q=(h[Q]||Q).replace(/\//g,"-"),Z=w.join(G,`${q}.json`);if(console.log(`Checking for cache file: ${Z}`),!H.existsSync(Z))return null;let X=JSON.parse(H.readFileSync(Z,"utf-8"));if(!X.fetchedAt)return console.log(`Cache for ${Q} missing fetchedAt timestamp, invalidating`),null;if(["Crafters of fine Open Source products","Go home.","Package information for","pkgx package","Loading...","Please wait..."].some((A)=>X.description&&X.description.includes(A)))return console.log(`Cache for ${Q} has generic description "${X.description}", invalidating`),null;if(!X.versions||X.versions.length===0)return console.log(`Cache for ${Q} has no versions, invalidating`),null;let B=(K.cacheExpirationMinutes||c)*60*1000,C=Date.now();if(C-X.fetchedAt>B)return console.log(`Cache for ${Q} has expired (age: ${Math.round((C-X.fetchedAt)/60000)} minutes)`),null;return console.log(`Using cached data for ${Q} (age: ${Math.round((C-X.fetchedAt)/60000)} minutes)`),{packageInfo:X,filePath:Z}}catch(G){return console.error(`Error reading cache for ${Q}:`,G),null}}function jQ(Q,K,G={}){let $={...K,fetchedAt:Date.now()},q=G.cacheDir||k;if(!H.existsSync(q))H.mkdirSync(q,{recursive:!0});let Z=Q.replace(/\//g,"-"),X=w.join(q,`${Z}.json`);H.writeFileSync(X,JSON.stringify($,null,2));let Y=G.outputDir||"packages";if(!H.existsSync(Y))H.mkdirSync(Y,{recursive:!0});let W=N(Y,Q,K);return{cachePath:X,outputPath:W}}function KQ(){return Promise.resolve()}async function SQ(Q={}){let K=Q.apiUrl||"https://api.github.com/repos/pkgxdev/pantry/contents/projects";try{console.log(`Fetching projects from GitHub API: ${K}`);let G=await fetch(K,{headers:{Accept:"application/vnd.github.v3+json"}});if(!G.ok)throw Error(`Failed to fetch from GitHub API: ${G.statusText}`);let q=(await G.json()).filter((Z)=>Z.type==="dir").map((Z)=>({name:Z.name,url:Z.html_url}));return console.log(`Retrieved ${q.length} projects from GitHub API`),q.sort((Z,X)=>Z.name.localeCompare(X.name)),q}catch(G){throw console.error("Error fetching projects from GitHub API:",G),G}}async function t(Q,K={}){let G=Q,$=Q;if(Q.includes("/")){let[q,Z]=Q.split("/");console.log(`Identified nested package: domain=${q}, name=${Z}`)}if(h[Q])console.log(`'${Q}' is an alias for '${h[Q]}', redirecting...`),$=h[Q],Q=h[Q];try{let q=K.timeout||p,Z=await JQ(Q,{timeout:q,useClientSideScraper:!0}),X={name:Z.displayName||Z.name||Q.split("/").pop()||Q,domain:Z.domain||Q,description:Z.description||Z.brief||"",packageYmlUrl:`https://github.com/pkgxdev/pantry/tree/main/projects/${Q}/package.yml`,homepageUrl:Z.homepage||"",githubUrl:Z.github||"",installCommand:`pantry install ${Q}`,pkgxInstallCommand:`sh <(curl https://pkgx.sh) +${Q} -- $SHELL -i`,pantryInstallCommand:`pantry install ${Q}`,programs:Z.provides||[],companions:Array.isArray(Z.companions)?Z.companions:[],dependencies:Array.isArray(Z.dependencies)?Z.dependencies:[],buildDependencies:Z.buildDependencies||[],versions:Z.versions||[],aliases:[]};if(!X.versions||X.versions.length===0){let Y=X.domain||Q;if(!["apache.org","breakfastquay.com","catb.org","bloomreach.com","cairographics.org","certifi.io","charm.sh","aws.amazon.com","google.com","microsoft.com","mozilla.org","freedesktop.org","gnome.org","kde.org","sourceforge.net","sf.net"].some((J)=>Y.startsWith(J)))try{let J=X.domain||Q,B=await HQ(J);X.versions=B}catch(J){console.warn(`Failed to fetch versions for ${Q} from GitHub API:`,J),X.versions=[]}}if(X.versions&&X.versions.length>0)try{X.versions.sort((Y,W)=>{try{return-1*Bun.semver.order(Y,W)}catch{return m(Y,W)}})}catch(Y){console.warn(`Warning: Failed to sort versions for ${Q} using semver:`,Y)}return X.name=X.name||G,X.domain=X.domain||$,X.programs=X.programs||[],X.companions=X.companions||[],X.dependencies=X.dependencies||[],X.versions=X.versions||[],{packageInfo:X,originalName:G,fullDomainName:$}}catch(q){return console.error(`Error in fetchPantryPackage for ${Q}:`,q),RQ(Q,G,$)}}async function HQ(Q){try{let{shouldProceedWithGitHubRequest:K,saveRateLimitInfo:G}=await import("./chunk-85nbpqdk.js");if(!K())return console.warn("Skipping GitHub API request for versions due to rate limiting"),[];let $=await fetch(`https://api.github.com/repos/pkgxdev/pantry/contents/projects/${Q}`,{headers:{Accept:"application/vnd.github.v3+json","User-Agent":"ts-pantry"},signal:AbortSignal.timeout(15000)});if(G($.headers),$.status===403){let Z=$.headers.get("X-RateLimit-Remaining"),X=$.headers.get("X-RateLimit-Reset"),Y=X?new Date(Number(X)*1000).toLocaleString():"unknown";return console.warn(`GitHub API rate limit exceeded. Remaining: ${Z||0}, Reset: ${Y}`),[]}if(!$.ok)throw Error(`GitHub API responded with ${$.status}: ${$.statusText}`);return(await $.json()).filter((Z)=>Z.name.match(/^v\d+/)).map((Z)=>Z.name)}catch(K){return console.error("Error fetching versions from GitHub:",K),[]}}var LQ=300000,l=null;function UQ(){let Q=async(K)=>{if(console.log(`
|
|
35
|
-
Received ${K} signal. Cleaning up resources...`),l)clearInterval(l);await KQ(),console.log("Resources cleaned up. Exiting."),setTimeout(()=>{console.log("Forcing process exit..."),I.exit(0)},5000)};I.on("SIGINT",()=>Q("SIGINT")),I.on("SIGTERM",()=>Q("SIGTERM")),I.on("uncaughtException",(K)=>{console.error("Uncaught exception:",K),Q("uncaughtException")})}UQ();I.on("uncaughtException",(Q)=>{let K=String(Q);if(console.error("Uncaught exception caught:",Q.message),Q.message.includes("No target found for targetId")||Q.message.includes("Assertion error")||Q.message.includes("Target page, context or browser has been closed")||Q.message.includes("Failed to connect")||Q.message.includes("Connection closed")||Q.message.includes("Protocol error")||K.includes("WebSocket connection closed")||Q.message.includes("Browser has been closed")){console.error("Browser/network connection error detected, continuing execution...");return}console.error("Non-browser error, exiting..."),I.exit(1)});I.on("unhandledRejection",(Q,K)=>{let G=String(Q);if(console.error("Unhandled rejection caught:",G),G.includes("No target found for targetId")||G.includes("Assertion error")||G.includes("Target page, context or browser has been closed")||G.includes("Failed to connect")||G.includes("Connection closed")||G.includes("Protocol error")||G.includes("WebSocket connection closed")||G.includes("Browser has been closed")){console.error("Browser/network connection error in promise, continuing execution...");return}console.error("Non-browser promise rejection, exiting..."),I.exit(1)});function yQ(){if(l)clearInterval(l);l=setInterval(()=>{console.log("Running periodic browser resource cleanup..."),KQ().then(()=>console.log("Periodic cleanup completed")).catch((Q)=>console.error("Error during periodic cleanup:",Q))},LQ)}async function vQ(Q={}){let K=Q.timeout||p,G=Q.outputDir||"packages",$=Q.cacheDir||k,q=Q.cache!==!1,Z=Q.cacheExpirationMinutes||c,X=Math.min(Q.concurrency||6,8),Y=Q.pantryDir||"src/pantry";if(!Q.outputJson)console.log(`Starting bulk fetch with concurrency: ${X}, timeout: ${K}ms`);let W=Date.now(),J=[];try{if(!Q.outputJson)console.log("Scanning local pantry for packages...");try{if(J=await OQ(Y),!Q.outputJson)console.log(`Found ${J.length} packages in local pantry`)}catch(j){if(!Q.outputJson)console.warn("Failed to scan local pantry, falling back to consts:",j);try{let{ALL_KNOWN_PACKAGES:z}=await import("./chunk-g3ex932z.js");if(J=[...z].filter((L)=>L&&L!=="undefined"&&L!=="aliases"&&L!=="index"),!Q.outputJson)console.log(`Using comprehensive package list: ${J.length} packages`)}catch(z){if(!Q.outputJson)console.warn("Failed to load consts, falling back to GitHub API:",z);try{let L=await fetch("https://api.github.com/repos/pkgxdev/pantry/contents/projects",{headers:{"User-Agent":"ts-pantry-fetcher",Accept:"application/vnd.github.v3+json"}});if(L.ok){let U=(await L.json()).filter((V)=>V.type==="dir").map((V)=>V.name).sort();if(!Q.outputJson)console.log(`Retrieved ${U.length} projects from GitHub API`);J=U}else throw Error(`GitHub API returned ${L.status}`)}catch(L){if(!Q.outputJson)console.warn("Failed to fetch from GitHub API, falling back to local discovery:",L);if(H.existsSync(G))J=H.readdirSync(G).filter((U)=>U.endsWith(".ts")).map((U)=>w.basename(U,".ts")),console.log(`Found ${J.length} existing packages`)}}}if(J.length===0)return console.error("No packages found to process"),[];let B=["android.com","apache.org","akuity.io","alsa-project.org","anchore.com","aomedia.googlesource.com","apollographql.com","facebook.com","google.com","microsoft.com","mozilla.org","sourceforge.net","x.org","xiph.org","yui.github.io","crates.io","gitlab.com","github.com"],C=new Set,A=J.filter((j)=>j.startsWith("github.com/"));for(let j of A){let z=j.split("/");if(z.length>2){let L=z.slice(0,2).join("/");C.add(L)}}if(J=J.filter((j)=>{if(j.endsWith("/.pkgroot"))return console.log(`Filtering out .pkgroot marker: ${j}`),!1;if(j.endsWith("/README.rst"))return console.log(`Filtering out README.rst documentation: ${j}`),!1;if(j==="agwa.name")return console.log("Filtering out standalone agwa.name - only agwa.name/git-crypt is valid"),!1;if(B.includes(j))return console.log(`Filtering out parent domain ${j} - only has nested packages`),!1;if(C.has(j))return console.log(`Filtering out GitHub parent path ${j} - only has nested packages`),!1;if(j==="undefined"||j==="aliases"||j==="index")return!1;return!0}),console.log(`Found ${J.length} packages to process`),Q.limit&&Q.limit>0)J=J.slice(0,Q.limit),console.log(`Limited to ${J.length} packages`);let F=[],E=[],x=0,_=Math.min(X,6),O=[];for(let j=0;j<J.length;j+=_)O.push(J.slice(j,j+_));if(!Q.outputJson)console.log(`Processing ${J.length} packages in ${O.length} batches...`);for(let j=0;j<O.length;j++){let z=O[j];if(!Q.outputJson)console.log(`Processing batch ${j+1}/${O.length} (${z.length} packages)`);let L=z.map(async(R)=>{try{let S=w.join($,`${R.replace(/\//g,"-")}.json`);if(q&&H.existsSync(S)){let d=H.statSync(S),u=(Date.now()-d.mtime.getTime())/60000;if(u<Z){if(!Q.outputJson)console.log(`Using cached data for ${R} (age: ${Math.round(u)} minutes)`);try{let g=JSON.parse(H.readFileSync(S,"utf-8"));delete g.fetchedAt;let f=N(G,R,g);if(!Q.outputJson)console.log(`Using cached data for ${R} (saved to ${f})`);return{success:!0,packageName:R}}catch{console.warn(`Cache file corrupted for ${R}, will refetch`)}}}let v=await VQ(R,{...Q,pantryDir:Y,timeout:K,cache:q,cacheDir:$,cacheExpirationMinutes:Z});if(v){let{outputPath:d}=jQ(R,v.packageInfo,{cacheDir:$,outputDir:G,cache:q});if(!Q.outputJson)console.log(`Successfully processed ${R} (saved to ${d})`);return{success:!0,packageName:R}}else return console.warn(`Failed to fetch ${R}`),{success:!1,packageName:R}}catch(S){return console.error(`Error processing ${R}:`,S),{success:!1,packageName:R}}}),M=await Promise.allSettled(L);for(let R of M)if(x++,R.status==="fulfilled")if(R.value.success)F.push(R.value.packageName);else E.push(R.value.packageName);else console.error("Batch promise rejected:",R.reason),E.push("unknown");let U=Math.round((Date.now()-W)/1000),V=Math.round(x/U*10)/10,y=Math.round((J.length-x)/V);if(!Q.outputJson)console.log(`Batch ${j+1}/${O.length} complete. Progress: ${x}/${J.length} (${Math.round(x/J.length*100)}%) | Success: ${F.length} | Failed: ${E.length} | Rate: ${V}/s | ETA: ${y}s`);if(j<O.length-1)await new Promise((R)=>setTimeout(R,1000))}let T=Math.round((Date.now()-W)/1000);if(!Q.outputJson){if(console.log(`
|
|
36
|
-
Completed in ${T}s. Successfully processed: ${F.length}, Failed: ${E.length}`),E.length>0)console.log(`Failed packages: ${E.slice(0,10).join(", ")}${E.length>10?` ... and ${E.length-10} more`:""}`)}return F}catch(B){return console.error("Error in fetchAndSaveAllPackages:",B),[]}}function RQ(Q,K,G){let $=Q.split("/"),q=$[0];return{packageInfo:{name:($.length>1?$.slice(1).join("/"):null)||Q,domain:q,description:`Package information for ${Q}`,packageYmlUrl:"",homepageUrl:"",githubUrl:"",installCommand:`pantry install ${Q}`,pkgxInstallCommand:`sh <(curl https://pkgx.sh) +${Q} -- $SHELL -i`,pantryInstallCommand:`pantry install ${Q}`,programs:[],companions:[],dependencies:[],versions:[]},originalName:K,fullDomainName:G}}async function EQ(Q,K,G,$=!1,q=1,Z=3,X=!1,Y={}){try{let W=Y.cache!==!1,J=Y.cacheDir||k;if(!W)console.log(`Cache disabled for ${Q}, will fetch directly`);else{let E=_Q(Q,{cacheDir:J,cacheExpirationMinutes:Y.cacheExpirationMinutes,cache:Y.cache});if(E){let{packageInfo:x}=E,_=x.domain||Q,O=x.aliases||[],T=N(K,Q,x);return console.log(`Using cached data for ${Q} (saved to ${T})`),{success:!0,fullDomainName:_,aliases:O,filePath:T}}}let C=G+(q-1)*1e4;console.log(`Using timeout for ${Q} (attempt ${q}): ${C}ms`);let A=C,F=new Promise((E,x)=>{setTimeout(()=>{console.error(`Operation timeout for ${Q} after ${A}ms`),x(Error(`Operation timeout after ${A}ms`))},A)});if(Q.includes("/")){let E=Q.split("/"),x=E[0],_=E.slice(1).join("/");console.log(`Processing nested package: domain=${x}, subPath=${_}`);try{let O=t(`${x}/${_}`,{timeout:C,browser:Y.browser}),T=await Promise.race([O,F]),{packageInfo:j,originalName:z,fullDomainName:L}=T;if(j.versions&&j.versions.length>0)try{j.versions.sort((S,v)=>{try{return-1*Bun.semver.order(S,v)}catch{return m(S,v)}})}catch(S){console.warn(`Warning: Failed to sort versions for ${Q} using semver:`,S)}let M=L.replace(/\//g,"-"),U=[];if(j.aliases&&j.aliases.length>0)U.push(...j.aliases);for(let[S,v]of Object.entries(h))if(v===L&&!U.includes(S))U.push(S);if(z!==L&&!U.includes(z))U.push(z);let V=["cli","app","tool","server","client","api","lib","core"];if(!U.includes(_)&&!V.includes(_.toLowerCase()))U.push(_);let y={...j,fullPath:Q,aliases:U.length>0?U:[]};if(W){let S=w.join(J,`${M}.json`),v={...y,fetchedAt:Date.now()};if(!H.existsSync(J))H.mkdirSync(J,{recursive:!0});H.writeFileSync(S,JSON.stringify(v,null,2)),console.log(`Saved package data to cache: ${S}`)}let R=N(K,L,y);return console.log(`Successfully saved nested package ${Q} to ${R} with aliases: ${U.join(", ")||"none"}`),{success:!0,fullDomainName:L,aliases:U,filePath:R}}catch(O){if(O.toString().includes("404")||O.toString().includes("Not Found"))return console.error(`Package ${Q} returned 404 Not Found.`),console.error(`Skipping ${Q} to avoid overwriting existing files.`),{success:!1,fullDomainName:Q};throw O}}else try{let E=t(Q,{timeout:C,browser:Y.browser}),x=await Promise.race([E,F]),{packageInfo:_,originalName:O,fullDomainName:T}=x,j=_.description&&_.description.trim()!=="",z=_.versions&&_.versions.length>0,L=_.programs&&_.programs.length>0,M=_.packageYmlUrl&&_.packageYmlUrl.length>0,U=_.dependencies&&_.dependencies.length>0,V=_.companions&&_.companions.length>0,y=j&&(_.description.toLowerCase().trim()==="go home."||_.description.toLowerCase().trim()==="page not found"||_.description.toLowerCase().trim()==="not found"||_.description.toLowerCase().trim()==="404"||_.description.toLowerCase().trim()==="error"),R=j&&!y,S=z||L||M||U||V,v=_.domain&&_.domain.includes(".");if(!(R||S||v))return console.error(`Package ${Q} appears to have no meaningful data. Skipping to avoid creating empty files.`),{success:!1,fullDomainName:Q};let u=_.name&&_.name!==T&&_.name!==T.split("/")[0]&&_.name.length>1&&!_.name.includes("/")?r(_.name):null,g=T.replace(/\//g,"-"),f=u?w.join(K,`${u}.ts`):w.join(K,`${g}.ts`);if(H.existsSync(f)){let b=H.readFileSync(f,"utf-8"),D=b.includes("dependencies: [")&&!b.includes("dependencies: [] as const"),i=_.dependencies.length===0,n=!b.includes("description: 'Package information for")&&!b.includes("description: '' as const"),e=_.description.includes("Package information for")||_.description.trim()==="";if(D&&i||n&&e)return console.warn(`⚠️ Existing file ${f} has better data than new fetch. Skipping to prevent data loss.`),console.warn(` Existing deps: ${D}, New deps: ${!i}`),console.warn(` Existing desc: ${n}, New desc: ${!e}`),{success:!1,fullDomainName:Q}}if(_.versions&&_.versions.length>0)try{_.versions.sort((b,D)=>{try{return-1*Bun.semver.order(b,D)}catch{return m(b,D)}})}catch(b){console.warn(`Warning: Failed to sort versions for ${Q} using semver:`,b)}let XQ=T.replace(/\//g,"-"),P=[];if(_.aliases&&_.aliases.length>0)P.push(..._.aliases);for(let[b,D]of Object.entries(h))if(D===T&&!P.includes(b))P.push(b);if(O!==T&&!P.includes(O))P.push(O);let s={..._,fullPath:Q,aliases:P.length>0?P:[]};if(W){let b=w.join(J,`${XQ}.json`),D={...s,fetchedAt:Date.now()};if(!H.existsSync(J))H.mkdirSync(J,{recursive:!0});H.writeFileSync(b,JSON.stringify(D,null,2)),console.log(`Saved package data to cache: ${b}`)}let o=N(K,T,s);return console.log(`Successfully saved ${Q} to ${o} with aliases: ${P.join(", ")||"none"}`),{success:!0,fullDomainName:T,aliases:P,filePath:o}}catch(E){if(E.toString().includes("404")||E.toString().includes("Not Found"))return console.error(`Package ${Q} returned 404 Not Found. Skipping to avoid overwriting existing files.`),{success:!1,fullDomainName:Q};throw E}}catch(W){let J=String(W),B=J.includes("Operation timed out after")||J.includes("Operation timeout after")||J.includes("timeout")||J.includes("Timeout")||J.includes("Navigation timeout"),C=J.includes("No target found")||J.includes("targetId")||J.includes("Target page, context or browser has been closed")||J.includes("Protocol error")||J.includes("Connection closed")||J.includes("Assertion error")||J.includes("Browser has been closed")||J.includes("Target closed")||J.includes("Session closed")||J.includes("WebSocket connection closed");if(B)console.error(`Timeout error for ${Q}:`,J.substring(0,200)),await new Promise((F)=>setTimeout(F,1000*q));else if(C){if(console.error(`Browser connection error for ${Q}:`,J.substring(0,200)),Y.browser)try{await Y.browser.close().catch(()=>{})}catch{}await new Promise((F)=>setTimeout(F,3000*q))}if(q>=Z){if(console.error(`Failed to fetch package ${Q} after ${q} attempts:`,W),X){let F=w.join(I.cwd(),`${Q.replace(/\//g,"-")}-error.txt`);H.writeFileSync(F,`Error fetching ${Q}:
|
|
37
|
-
${W.toString()}
|
|
38
|
-
|
|
39
|
-
Stack:
|
|
40
|
-
${W.stack||"No stack trace available"}`),console.error(`Saved error details to ${F}`)}return console.error(`Skipping ${Q} after ${q} failed attempts to avoid overwriting existing files.`),{success:!1,fullDomainName:Q}}console.error(`Attempt ${q} failed for ${Q}, retrying...`,W);let A=500*q;if(C)A=2000*q;else if(B)A=1000*q;return await new Promise((F)=>setTimeout(F,A)),EQ(Q,K,G,$,q+1,Z,X,Y)}}async function OQ(Q="src/pantry"){if(!H.existsSync(Q))throw Error(`Pantry directory not found: ${Q}. Please run 'bun ./bin/cli.ts update-pantry' first.`);let K=[];function G($,q=""){let Z=H.readdirSync($,{withFileTypes:!0}),X=w.join($,"package.yml");if(q&&H.existsSync(X))K.push(q);for(let Y of Z)if(Y.isDirectory()&&!Y.name.startsWith(".")){let W=q?`${q}/${Y.name}`:Y.name,J=w.join($,Y.name);G(J,W)}}return G(Q),console.log(`Found ${K.length} packages in pantry`),K.sort()}async function BQ(Q,K="src/pantry"){let G=w.join(K,Q,"package.yml");if(!H.existsSync(G))return console.warn(`Package.yml not found for ${Q}`),null;try{let $=H.readFileSync(G,"utf-8"),q=[],Z=[],X=$.split(`
|
|
41
|
-
`),Y=!1,W=!1,J=!1,B="";for(let z of X){if(z.match(/^dependencies:\s*$/)){Y=!0,W=!1,J=!1;continue}if(z.match(/^\s{2}dependencies:\s*$/)){W=!0,Y=!1,J=!1;continue}if(Y||W){if(z.match(/^\s*$/)||Y&&z.match(/^\S/)||W&&!z.match(/^\s{4,}/)){Y=!1,W=!1,J=!1;continue}let L=z.match(/^\s{2}(linux|darwin|windows):\s*$/);if(L){J=!0,B=L[1];continue}if(J){let M=z.match(/^\s{4,}([^\s:]+):\s*['"]?([^'"]+)['"]?/);if(M){let U=M[1],V=M[2].trim(),y=`${B}:`;if(V&&V!=="*"){let R=/^[~^>=<@]/.test(V),S=/^[\d.]+$/.test(V)&&/^\d/.test(V),d=`${y}${U}${R?"":S?"@":"^"}${V}`;if(W)Z.push(d);else q.push(d)}else{let R=`${y}${U}`;if(W)Z.push(R);else q.push(R)}}else if(!z.match(/^\s{4,}/)&&!z.match(/^\s*$/))J=!1,B=""}else{let M=z.match(/^\s{2,3}([^\s:]+):\s*['"]?([^'"]+)['"]?/);if(M){let U=M[1],V=M[2].trim();if(["linux","darwin","windows"].includes(U))continue;if(V&&V!=="*"){let y=/^[~^>=<@]/.test(V),R=/^[\d.]+$/.test(V)&&/^\d/.test(V),v=`${U}${y?"":R?"@":"^"}${V}`;if(W)Z.push(v);else q.push(v)}else{let y=U;if(W)Z.push(y);else q.push(y)}}}}}let C=[],A=!1;for(let z of X){if(z.match(/^runtime:\s*$/)){A=!0;continue}if(A){if(z.match(/^\s*$/)||z.match(/^\S/)){A=!1;continue}if(z.match(/^\s+env:\s*$/))continue;if(z.match(/^\s+[A-Z_]+:\s*\$\{\{/))continue;let L=z.match(/^\s+([^\s:]+):\s*['"]?([^'"]+)['"]?/);if(L){let M=L[1],U=L[2].trim();if(/^[A-Z_]+$/.test(M))continue;if(U&&U!=="*"){let V=/^[~^>=<@]/.test(U),y=/^[\d.]+$/.test(U)&&/^\d/.test(U),R=V?"":y?"@":"^";C.push(`${M}${R}${U}`)}else C.push(M)}}}let F="",E="",x=$.match(/distributable:[\t\v\f\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*\n\s*url:\s*(.+)/);if(x){let z=x[1].trim();if(z.includes("github.com")){let L=z.match(/git\+https:\/\/github\.com\/([^/]+\/[^.]+)/);if(L){if(E=`https://github.com/${L[1]}`,L[1]==="python-attrs/attrs")F="https://www.attrs.org/"}}}let _=[],O=!1,T=!1;for(let z of X){if(z.match(/^provides:\s*$/)){O=!0,T=!1;continue}if(O){if(z.match(/^\S/)&&!z.match(/^\s*$/)){O=!1;continue}if(z.match(/^\s+(darwin|linux|windows):\s*$/)){T=!0;continue}let L=z.match(/^\s+-\s+(?:bin|sbin)\/(.+)/);if(L){let M=L[1].trim();if(!_.includes(M))_.push(M)}}}return{name:Q.split("/").pop()||Q,domain:Q,dependencies:q,buildDependencies:Z,companions:C,programs:_,homepageUrl:F,githubUrl:E}}catch($){return console.warn(`Error reading package.yml for ${Q}:`,$),null}}async function VQ(Q,K={}){let G=K.pantryDir||"src/pantry";try{let $=await BQ(Q,G);try{let q=await t(Q,K),Z=$?.domain||q.packageInfo.domain,X=$Q(Z),Y=q.packageInfo.aliases||[];if(X.length>0)if(qQ(Z))Y=X;else Y=[...new Set([...Y,...X])];let W=[],J=[],B="",C="",A=q.packageInfo.versions||[],F=q.packageInfo.programs||[],E=$?.programs||[];if(A.length===0||F.length===0&&E.length===0){let _=K.outputDir||"src/packages",O=Q.split("/"),T=O.length>1?w.join(_,...O.slice(0,-1),`${O[O.length-1]}.ts`):w.join(_,`${Q.replace(/\./g,"")}.ts`);if(H.existsSync(T))try{let j=H.readFileSync(T,"utf-8");if(A.length===0){let z=j.match(/versions:\s*\[([\s\S]*?)\]\s*as\s*const/);if(z&&z[1].trim())W=z[1].match(/'([^']+)'/g)?.map((L)=>L.replace(/'/g,""))||[]}if(F.length===0&&E.length===0){let z=j.match(/programs:\s*\[([\s\S]*?)\]\s*as\s*const/);if(z&&z[1].trim())J=z[1].match(/'([^']+)'/g)?.map((L)=>L.replace(/'/g,""))||[]}if(!q.packageInfo.description){let z=j.match(/description:\s*'([^']*)'\s*as\s*const/);if(z&&z[1])B=z[1]}if(!q.packageInfo.homepageUrl&&!$?.homepageUrl){let z=j.match(/homepageUrl:\s*'([^']*)'\s*as\s*const/);if(z&&z[1])C=z[1]}}catch{}}return{packageInfo:{...q.packageInfo,dependencies:$?.dependencies&&$.dependencies.length>0?$.dependencies:q.packageInfo.dependencies,buildDependencies:$?.buildDependencies&&$.buildDependencies.length>0?$.buildDependencies:q.packageInfo.buildDependencies,companions:$?.companions&&$.companions.length>0?$.companions:q.packageInfo.companions,programs:F.length>0?F:E.length>0?E:J.length>0?J:[],versions:A.length>0?A:W,domain:$?.domain||q.packageInfo.domain,description:q.packageInfo.description||B||"",name:q.packageInfo.name||$?.name||Q.split("/").pop()||Q,homepageUrl:$?.homepageUrl||q.packageInfo.homepageUrl||C,githubUrl:$?.githubUrl||q.packageInfo.githubUrl,aliases:Y},originalName:q.originalName,fullDomainName:q.fullDomainName}}catch(q){if(!$)return console.warn(`No pantry or web data available for ${Q}:`,q),null;console.warn(`Failed to fetch web metadata for ${Q}, using pantry data only:`,q);let Z=[],X=[],Y="",W="",J=K.outputDir||"src/packages",B=Q.split("/"),C=B.length>1?w.join(J,...B.slice(0,-1),`${B[B.length-1]}.ts`):w.join(J,`${Q.replace(/\./g,"")}.ts`);if(H.existsSync(C))try{let E=H.readFileSync(C,"utf-8"),x=E.match(/versions:\s*\[([\s\S]*?)\]\s*as\s*const/);if(x&&x[1].trim())Z=x[1].match(/'([^']+)'/g)?.map((j)=>j.replace(/'/g,""))||[];let _=E.match(/programs:\s*\[([\s\S]*?)\]\s*as\s*const/);if(_&&_[1].trim())X=_[1].match(/'([^']+)'/g)?.map((j)=>j.replace(/'/g,""))||[];let O=E.match(/description:\s*'([^']*)'\s*as\s*const/);if(O&&O[1])Y=O[1];let T=E.match(/homepageUrl:\s*'([^']*)'\s*as\s*const/);if(T&&T[1])W=T[1]}catch{}let A=$.programs&&$.programs.length>0?$.programs:X;return{packageInfo:{name:$.name||Q.split("/").pop()||Q,domain:$.domain||Q,description:Y||"",installCommand:`pantry install ${Q}`,pkgxInstallCommand:`sh <(curl https://pkgx.sh) +${Q} -- $SHELL -i`,pantryInstallCommand:`pantry install ${Q}`,programs:A,companions:$.companions||[],dependencies:$.dependencies||[],versions:Z,buildDependencies:$.buildDependencies||[],packageYmlUrl:`https://github.com/pkgxdev/pantry/tree/main/projects/${Q}/package.yml`,homepageUrl:W||$.homepageUrl||"",githubUrl:$.githubUrl||""},originalName:Q,fullDomainName:Q}}}catch($){return console.error(`Error processing pantry package ${Q}:`,$),null}}
|
|
42
|
-
export{N as Ka,AQ as La,_Q as Ma,jQ as Na,KQ as Oa,SQ as Pa,t as Qa,UQ as Ra,yQ as Sa,vQ as Ta,EQ as Ua,OQ as Va,BQ as Wa,VQ as Xa};
|
package/scripts/pantry-cli.ts
DELETED
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Pantry CLI
|
|
5
|
-
*
|
|
6
|
-
* A CLI tool that uses your custom S3 registry for packages
|
|
7
|
-
* built with custom extensions (like PHP with pdo_pgsql).
|
|
8
|
-
*
|
|
9
|
-
* Usage:
|
|
10
|
-
* pantry install # Install packages from pantry.yaml
|
|
11
|
-
* pantry shell # Start a shell with packages in PATH
|
|
12
|
-
* pantry run <cmd> # Run a command with packages in PATH
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import { existsSync, readFileSync, mkdirSync } from 'node:fs'
|
|
16
|
-
import { execSync, spawn } from 'node:child_process'
|
|
17
|
-
import { join } from 'node:path'
|
|
18
|
-
import { homedir } from 'node:os'
|
|
19
|
-
|
|
20
|
-
const INSTALL_DIR = join(homedir(), '.pantry')
|
|
21
|
-
const DEFAULT_BUCKET = 'pantry-registry'
|
|
22
|
-
const DEFAULT_REGION = 'us-east-1'
|
|
23
|
-
|
|
24
|
-
interface Config {
|
|
25
|
-
dependencies: Record<string, string>
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function findConfig(): string | null {
|
|
29
|
-
const candidates = ['pantry.yaml', 'deps.yaml', '.pantry.yaml']
|
|
30
|
-
|
|
31
|
-
for (const candidate of candidates) {
|
|
32
|
-
if (existsSync(candidate)) {
|
|
33
|
-
return candidate
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return null
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function parseConfig(path: string): Config {
|
|
41
|
-
const content = readFileSync(path, 'utf-8')
|
|
42
|
-
const config: Config = { dependencies: {} }
|
|
43
|
-
|
|
44
|
-
const lines = content.split('\n')
|
|
45
|
-
let inDeps = false
|
|
46
|
-
|
|
47
|
-
for (const line of lines) {
|
|
48
|
-
const trimmed = line.trim()
|
|
49
|
-
|
|
50
|
-
if (trimmed === 'dependencies:') {
|
|
51
|
-
inDeps = true
|
|
52
|
-
continue
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (inDeps && line.match(/^\s+\S/)) {
|
|
56
|
-
const match = trimmed.match(/^([^:]+):\s*(.+)$/)
|
|
57
|
-
if (match) {
|
|
58
|
-
config.dependencies[match[1].trim()] = match[2].trim().replace(/['"]/g, '')
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
else if (inDeps && !line.match(/^\s/) && trimmed !== '') {
|
|
62
|
-
inDeps = false
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return config
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function getInstalledPackagePaths(packages: string[]): string[] {
|
|
70
|
-
const paths: string[] = []
|
|
71
|
-
|
|
72
|
-
for (const pkg of packages) {
|
|
73
|
-
const binDir = join(INSTALL_DIR, pkg, 'current', 'bin')
|
|
74
|
-
const sbinDir = join(INSTALL_DIR, pkg, 'current', 'sbin')
|
|
75
|
-
|
|
76
|
-
if (existsSync(binDir)) paths.push(binDir)
|
|
77
|
-
if (existsSync(sbinDir)) paths.push(sbinDir)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return paths
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function getLibraryPaths(packages: string[]): string[] {
|
|
84
|
-
const paths: string[] = []
|
|
85
|
-
|
|
86
|
-
for (const pkg of packages) {
|
|
87
|
-
const libDir = join(INSTALL_DIR, pkg, 'current', 'lib')
|
|
88
|
-
if (existsSync(libDir)) paths.push(libDir)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return paths
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
async function install(bucket: string, region: string): Promise<boolean> {
|
|
95
|
-
const configPath = findConfig()
|
|
96
|
-
|
|
97
|
-
if (!configPath) {
|
|
98
|
-
console.error('❌ No pantry.yaml or deps.yaml found in current directory')
|
|
99
|
-
return false
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
console.log(`📦 Installing from ${configPath}...`)
|
|
103
|
-
|
|
104
|
-
// Run the download script
|
|
105
|
-
const scriptPath = join(import.meta.dir, 'download-from-s3.ts')
|
|
106
|
-
const cmd = `bun "${scriptPath}" -c "${configPath}" -b "${bucket}" -r "${region}"`
|
|
107
|
-
|
|
108
|
-
try {
|
|
109
|
-
execSync(cmd, { stdio: 'inherit' })
|
|
110
|
-
return true
|
|
111
|
-
}
|
|
112
|
-
catch (error) {
|
|
113
|
-
return false
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function shellEnv(packages: string[]): Record<string, string> {
|
|
118
|
-
const binPaths = getInstalledPackagePaths(packages)
|
|
119
|
-
const libPaths = getLibraryPaths(packages)
|
|
120
|
-
|
|
121
|
-
const env = { ...process.env } as Record<string, string>
|
|
122
|
-
|
|
123
|
-
if (binPaths.length > 0) {
|
|
124
|
-
env.PATH = [...binPaths, process.env.PATH || ''].join(':')
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (libPaths.length > 0) {
|
|
128
|
-
env.LD_LIBRARY_PATH = [...libPaths, process.env.LD_LIBRARY_PATH || ''].join(':')
|
|
129
|
-
env.DYLD_LIBRARY_PATH = [...libPaths, process.env.DYLD_LIBRARY_PATH || ''].join(':')
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// Set custom indicator
|
|
133
|
-
env.PANTRY_CUSTOM = '1'
|
|
134
|
-
env.PANTRY_DIR = INSTALL_DIR
|
|
135
|
-
|
|
136
|
-
return env
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
async function startShell(packages: string[]): Promise<void> {
|
|
140
|
-
const env = shellEnv(packages)
|
|
141
|
-
const shell = process.env.SHELL || '/bin/bash'
|
|
142
|
-
|
|
143
|
-
console.log(`\n🐚 Starting shell with ${packages.length} packages in PATH`)
|
|
144
|
-
console.log(` Packages: ${packages.join(', ')}`)
|
|
145
|
-
console.log(` Exit with 'exit' or Ctrl+D\n`)
|
|
146
|
-
|
|
147
|
-
const child = spawn(shell, ['-i'], {
|
|
148
|
-
stdio: 'inherit',
|
|
149
|
-
env,
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
await new Promise<void>((resolve) => {
|
|
153
|
-
child.on('close', () => resolve())
|
|
154
|
-
})
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
async function runCommand(packages: string[], args: string[]): Promise<number> {
|
|
158
|
-
const env = shellEnv(packages)
|
|
159
|
-
|
|
160
|
-
const child = spawn(args[0], args.slice(1), {
|
|
161
|
-
stdio: 'inherit',
|
|
162
|
-
env,
|
|
163
|
-
})
|
|
164
|
-
|
|
165
|
-
return new Promise((resolve) => {
|
|
166
|
-
child.on('close', (code) => resolve(code || 0))
|
|
167
|
-
})
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function showStatus(packages: string[]): void {
|
|
171
|
-
console.log(`\n📊 Pantry Status`)
|
|
172
|
-
console.log(`${'='.repeat(50)}`)
|
|
173
|
-
console.log(`Install directory: ${INSTALL_DIR}`)
|
|
174
|
-
console.log(`\nInstalled packages:`)
|
|
175
|
-
|
|
176
|
-
for (const pkg of packages) {
|
|
177
|
-
const pkgDir = join(INSTALL_DIR, pkg)
|
|
178
|
-
const currentLink = join(pkgDir, 'current')
|
|
179
|
-
|
|
180
|
-
if (existsSync(currentLink)) {
|
|
181
|
-
try {
|
|
182
|
-
const version = readFileSync(currentLink, 'utf-8').trim() ||
|
|
183
|
-
execSync(`readlink "${currentLink}"`, { encoding: 'utf-8' }).trim()
|
|
184
|
-
console.log(` ✅ ${pkg} @ ${version}`)
|
|
185
|
-
}
|
|
186
|
-
catch {
|
|
187
|
-
console.log(` ✅ ${pkg}`)
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
else if (existsSync(pkgDir)) {
|
|
191
|
-
console.log(` ⚠️ ${pkg} (no current version linked)`)
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
console.log(` ❌ ${pkg} (not installed)`)
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
async function main(): Promise<void> {
|
|
200
|
-
const args = process.argv.slice(2)
|
|
201
|
-
const command = args[0]
|
|
202
|
-
|
|
203
|
-
// Parse global options
|
|
204
|
-
let bucket = DEFAULT_BUCKET
|
|
205
|
-
let region = DEFAULT_REGION
|
|
206
|
-
|
|
207
|
-
const bucketIdx = args.indexOf('--bucket')
|
|
208
|
-
if (bucketIdx !== -1 && args[bucketIdx + 1]) {
|
|
209
|
-
bucket = args[bucketIdx + 1]
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const regionIdx = args.indexOf('--region')
|
|
213
|
-
if (regionIdx !== -1 && args[regionIdx + 1]) {
|
|
214
|
-
region = args[regionIdx + 1]
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// Get config for package list
|
|
218
|
-
const configPath = findConfig()
|
|
219
|
-
const config = configPath ? parseConfig(configPath) : { dependencies: {} }
|
|
220
|
-
const packages = Object.keys(config.dependencies)
|
|
221
|
-
|
|
222
|
-
switch (command) {
|
|
223
|
-
case 'install':
|
|
224
|
-
case 'i':
|
|
225
|
-
const success = await install(bucket, region)
|
|
226
|
-
process.exit(success ? 0 : 1)
|
|
227
|
-
break
|
|
228
|
-
|
|
229
|
-
case 'shell':
|
|
230
|
-
case 'sh':
|
|
231
|
-
if (packages.length === 0) {
|
|
232
|
-
console.error('❌ No packages defined in pantry.yaml')
|
|
233
|
-
process.exit(1)
|
|
234
|
-
}
|
|
235
|
-
await startShell(packages)
|
|
236
|
-
break
|
|
237
|
-
|
|
238
|
-
case 'run':
|
|
239
|
-
case 'exec':
|
|
240
|
-
if (args.length < 2) {
|
|
241
|
-
console.error('Usage: pantry run <command> [args...]')
|
|
242
|
-
process.exit(1)
|
|
243
|
-
}
|
|
244
|
-
const exitCode = await runCommand(packages, args.slice(1))
|
|
245
|
-
process.exit(exitCode)
|
|
246
|
-
break
|
|
247
|
-
|
|
248
|
-
case 'status':
|
|
249
|
-
case 'list':
|
|
250
|
-
showStatus(packages)
|
|
251
|
-
break
|
|
252
|
-
|
|
253
|
-
case 'env':
|
|
254
|
-
// Print environment variables for sourcing
|
|
255
|
-
const env = shellEnv(packages)
|
|
256
|
-
console.log(`export PATH="${env.PATH}"`)
|
|
257
|
-
if (env.LD_LIBRARY_PATH) {
|
|
258
|
-
console.log(`export LD_LIBRARY_PATH="${env.LD_LIBRARY_PATH}"`)
|
|
259
|
-
}
|
|
260
|
-
if (env.DYLD_LIBRARY_PATH) {
|
|
261
|
-
console.log(`export DYLD_LIBRARY_PATH="${env.DYLD_LIBRARY_PATH}"`)
|
|
262
|
-
}
|
|
263
|
-
break
|
|
264
|
-
|
|
265
|
-
case 'help':
|
|
266
|
-
case '--help':
|
|
267
|
-
case '-h':
|
|
268
|
-
default:
|
|
269
|
-
console.log(`
|
|
270
|
-
pantry - Custom package manager using your S3 registry
|
|
271
|
-
|
|
272
|
-
Usage:
|
|
273
|
-
pantry <command> [options]
|
|
274
|
-
|
|
275
|
-
Commands:
|
|
276
|
-
install, i Install packages from pantry.yaml
|
|
277
|
-
shell, sh Start an interactive shell with packages in PATH
|
|
278
|
-
run, exec Run a command with packages in PATH
|
|
279
|
-
status, list Show installed package status
|
|
280
|
-
env Print environment variables for sourcing
|
|
281
|
-
help Show this help message
|
|
282
|
-
|
|
283
|
-
Options:
|
|
284
|
-
--bucket <name> S3 bucket name (default: ${DEFAULT_BUCKET})
|
|
285
|
-
--region <region> AWS region (default: ${DEFAULT_REGION})
|
|
286
|
-
|
|
287
|
-
Examples:
|
|
288
|
-
# Install all packages from pantry.yaml
|
|
289
|
-
pantry install
|
|
290
|
-
|
|
291
|
-
# Start a shell with packages available
|
|
292
|
-
pantry shell
|
|
293
|
-
|
|
294
|
-
# Run PHP with custom extensions
|
|
295
|
-
pantry run php -v
|
|
296
|
-
|
|
297
|
-
# Run composer install
|
|
298
|
-
pantry run composer install
|
|
299
|
-
|
|
300
|
-
# Source environment in current shell
|
|
301
|
-
eval $(pantry env)
|
|
302
|
-
|
|
303
|
-
Configuration:
|
|
304
|
-
Create a pantry.yaml in your project:
|
|
305
|
-
|
|
306
|
-
dependencies:
|
|
307
|
-
php.net: ^8.4
|
|
308
|
-
getcomposer.org: ^2
|
|
309
|
-
postgresql.org: ^17
|
|
310
|
-
redis.io: ^7
|
|
311
|
-
`)
|
|
312
|
-
break
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
main().catch((error) => {
|
|
317
|
-
console.error('Error:', error.message)
|
|
318
|
-
process.exit(1)
|
|
319
|
-
})
|