@visulima/vis 1.0.0-alpha.14 → 1.0.0-alpha.16
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/CHANGELOG.md +66 -0
- package/LICENSE.md +1023 -277
- package/dist/bin.js +1 -1
- package/dist/config/index.d.ts +121 -94
- package/dist/config/index.js +1 -1
- package/dist/packem_chunks/bin.js +305 -302
- package/dist/packem_chunks/config.js +18 -0
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +5 -5
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +4 -4
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +5 -5
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +2 -1
- package/dist/packem_chunks/handler21.js +18 -1
- package/dist/packem_chunks/handler22.js +1 -5
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +5 -3
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.js +3 -1
- package/dist/packem_chunks/handler27.js +1 -7
- package/dist/packem_chunks/handler28.js +1 -23
- package/dist/packem_chunks/handler29.js +7 -3
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler30.js +23 -18
- package/dist/packem_chunks/handler31.js +3 -1
- package/dist/packem_chunks/handler32.js +1 -2
- package/dist/packem_chunks/handler33.js +2 -25
- package/dist/packem_chunks/handler34.js +25 -2
- package/dist/packem_chunks/handler35.js +3 -3
- package/dist/packem_chunks/handler36.js +20 -20
- package/dist/packem_chunks/handler37.js +3 -3
- package/dist/packem_chunks/handler38.js +4 -4
- package/dist/packem_chunks/handler39.js +11 -11
- package/dist/packem_chunks/handler40.js +5 -5
- package/dist/packem_chunks/handler41.js +10 -24
- package/dist/packem_chunks/handler42.js +24 -10
- package/dist/packem_chunks/handler43.js +5 -5
- package/dist/packem_chunks/handler44.js +6 -6
- package/dist/packem_chunks/handler45.js +3 -3
- package/dist/packem_chunks/handler46.js +11 -11
- package/dist/packem_chunks/handler47.js +161 -36
- package/dist/packem_chunks/handler48.js +6 -6
- package/dist/packem_chunks/handler5.js +5 -5
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +2 -2
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +16 -16
- package/dist/packem_chunks/index.js +2 -2
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/tar.js +1 -1
- package/dist/packem_shared/{ai-analysis-Dzs_nUwM.js → ai-analysis-C_GpXikx.js} +3 -3
- package/dist/packem_shared/ai-cache-DrCLD4gc.js +1 -0
- package/dist/packem_shared/ai-fix-CWOz12Om.js +43 -0
- package/dist/packem_shared/applyDefaults-DLY94gWA.js +1 -0
- package/dist/packem_shared/cache-directory-C_U1qsIw.js +1 -0
- package/dist/packem_shared/definePlugin-CWm4Dv_t.js +1 -0
- package/dist/packem_shared/dependency-scan-YdgNVvoz.js +2 -0
- package/dist/packem_shared/docker-Dl0AoVTZ.js +60 -0
- package/dist/packem_shared/failure-log-CSC6KfcO.js +2 -0
- package/dist/packem_shared/flakiness-Dzz-I3dB.js +1 -0
- package/dist/packem_shared/{giget-BX2ixMoa.js → giget-CcEy_Elm.js} +2 -2
- package/dist/packem_shared/lifecycle-BC6Nst6i.js +2 -0
- package/dist/packem_shared/lockfile-i-qvq_k8.js +1 -0
- package/dist/packem_shared/otelPlugin-CJR2T_lk.js +1 -0
- package/dist/packem_shared/readTomlSync-1fKo0R52-DtxWULlF.js +109 -0
- package/dist/packem_shared/run-summary-utils-CJv75pla.js +1 -0
- package/dist/packem_shared/runtime-check-CBU6W8qG.js +1 -0
- package/dist/packem_shared/{selectors-BvtUXWGY.js → selectors-B2ISH581.js} +1 -1
- package/dist/packem_shared/toolchain-B7dckBQ1.js +5 -0
- package/dist/packem_shared/typosquats-B3A38-qx.js +1 -0
- package/dist/packem_shared/verify-WDStBFvK.js +1 -0
- package/dist/packem_shared/vis-update-app-D0uL3eO5.js +1 -0
- package/package.json +13 -15
- package/schemas/project.schema.json +12 -2
- package/schemas/vis-config.schema.json +248 -3
- package/dist/packem_chunks/applyDefaults.js +0 -2
- package/dist/packem_shared/ai-cache-Dtvmbsru.js +0 -1
- package/dist/packem_shared/ai-fix-BmLM72GS.js +0 -43
- package/dist/packem_shared/cache-directory-xASJia6M.js +0 -1
- package/dist/packem_shared/dependency-scan-DmwPKwLy.js +0 -2
- package/dist/packem_shared/docker-CA-scYu0.js +0 -2
- package/dist/packem_shared/failure-log-fD4DiFb1.js +0 -2
- package/dist/packem_shared/flakiness-BIg1rwvp.js +0 -1
- package/dist/packem_shared/index-OlP7U_t5.js +0 -6
- package/dist/packem_shared/lockfile-BXylopgH.js +0 -1
- package/dist/packem_shared/otelPlugin-y5hoCw4b.js +0 -1
- package/dist/packem_shared/registry-BHqKXiLb.js +0 -2
- package/dist/packem_shared/run-summary-utils-D39XBHWW.js +0 -1
- package/dist/packem_shared/runtime-check-BaKni2y1.js +0 -1
- package/dist/packem_shared/toolchain-B7sIiJxK.js +0 -5
- package/dist/packem_shared/typosquats-XkC1CnOa.js +0 -1
- package/dist/packem_shared/verify-BVTcVfoW.js +0 -1
- package/dist/packem_shared/vis-update-app-DR8c4OfG.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var h=Object.defineProperty;var f=(a,s)=>h(a,"name",{value:s,configurable:!0});import{createRequire as k}from"node:module";import{a as y,n as T,M as v}from"../packem_chunks/config.js";import{n as S}from"../packem_chunks/bin.js";const R=k(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=f(a=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[s,n]=l.versions.node.split(".").map(Number);if(s>22||s===22&&n>=3||s===20&&n>=16)return l.getBuiltinModule(a)}return R(a)},"__cjs_getBuiltinModule"),{readdirSync:j}=b("node:fs");var F=Object.defineProperty,d=f((a,s)=>F(a,"name",{value:s,configurable:!0}),"i");const P=d((a,s)=>{let n=0,o=0,r=0;for(const[,t]of a)switch(t.status){case"failure":{r+=1;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{o+=1;break}case"success":{n+=1;break}}const i=[];n>0&&i.push(`${String(n)} succeeded`),o>0&&i.push(`${String(o)} cached`),r>0&&i.push(`${String(r)} failed`);const c=(s/1e3).toFixed(1);return i.push(`${c}s`),i.join(" · ")},"formatTimingSummary"),p=d(a=>{const s=S(a);if(!y(s))return[];const n=j(s).filter(r=>r.endsWith(".json")),o=[];for(const r of n)try{o.push(T(v(s,r)))}catch{}return o},"loadRunSummaries"),D=d((a,s,n)=>{const o=n??p(a);if(o.length<2)return;let r=0,i=0;for(const e of o)typeof e.duration=="number"&&e.duration>0&&(r+=e.duration,i+=1);if(i<2)return;const c=r/i-s,t=Math.abs(c/1e3).toFixed(1);return Math.abs(c)<500?"(about average)":c>0?`(${t}s faster than avg)`:`(${t}s slower than avg)`},"compareDuration");var _=Object.defineProperty,m=f((a,s)=>_(a,"name",{value:s,configurable:!0}),"l");const E=m((a,s={},n)=>{const o=n??p(a);if(o.length===0)return[];const r=new Map;for(const t of o)if(!(s.since&&(t.startTime===void 0||t.startTime<s.since))&&Array.isArray(t.tasks))for(const e of t.tasks){if(e.cacheStatus==="HIT"||e.cacheStatus==="REMOTE_HIT"||e.cacheStatus==="SKIPPED")continue;const u=r.get(e.taskId)??{failures:0,project:e.target.project,successes:0,target:e.target.target,totalRuns:0};u.totalRuns+=1,e.exitCode!==void 0&&e.exitCode!==0?(u.failures+=1,u.lastFailure=e.startTime??t.startTime):u.successes+=1,r.set(e.taskId,u)}const i=s.minRuns??2,c=[];for(const[t,e]of r)e.totalRuns<i||e.failures!==0&&c.push({failures:e.failures,flakinessRate:e.failures/e.totalRuns,lastFailure:e.lastFailure,project:e.project,successes:e.successes,target:e.target,taskId:t,totalRuns:e.totalRuns});return c.sort((t,e)=>e.flakinessRate-t.flakinessRate),c},"analyzeFlakiness"),q=m(a=>{if(a.length===0)return["No flaky tasks detected."];const s=["Task","Runs","Failures","Rate","Last Failure"],n=a.map(t=>[t.taskId,String(t.totalRuns),String(t.failures),`${(t.flakinessRate*100).toFixed(1)}%`,t.lastFailure??"—"]),o=s.map((t,e)=>{let u=0;for(const g of n)u=Math.max(u,(g[e]??"").length);return Math.max(t.length,u)}),r=m((t,e)=>t.padEnd(e),"pad"),i=o.map(t=>"─".repeat(t)).join("──"),c=[s.map((t,e)=>r(t,o[e])).join(" "),i];for(const t of n)c.push(t.map((e,u)=>r(e,o[u])).join(" "));return c},"formatFlakinessTable");export{E as a,q as b,D as c,P as f,p as l};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var De=Object.defineProperty;var f=(r,e)=>De(r,"name",{value:e,configurable:!0});import{createRequire as Fe}from"node:module";const Ne=Fe(import.meta.url),z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=f(r=>{if(typeof z<"u"&&z.versions&&z.versions.node){const[e,t]=z.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return z.getBuiltinModule(r)}return Ne(r)},"__cjs_getBuiltinModule"),{createRequire:Me}=k("node:module"),{existsSync:x,createWriteStream:se,readdirSync:Ge,renameSync:He}=k("node:fs"),{readFile:ie,mkdir:H,rm:M,writeFile:Be,mkdtemp:Le}=k("node:fs/promises"),{PassThrough:ae,Readable:J,pipeline:Re}=k("node:stream"),{spawn:ce,spawnSync:Ue}=k("node:child_process"),{delimiter:q,resolve:We,dirname:Xe,normalize:Je,join:Y}=k("node:path"),{cwd:qe}=z,Ye=k("node:readline"),{pipeline:Ze}=k("node:stream/promises"),{homedir:Ve,tmpdir:le}=k("node:os"),{promisify:Ke}=k("node:util");var Qe=Object.defineProperty,et=f((r,e)=>Qe(r,"name",{value:e,configurable:!0}),"a$1"),Z=Object.defineProperty,tt=et((r,e)=>{let t={};for(var n in r)Z(t,n,{get:r[n],enumerable:!0});return e||Z(t,Symbol.toStringTag,{value:"Module"}),t},"__exportAll"),rt=Object.defineProperty,p=f((r,e)=>rt(r,"name",{value:e,configurable:!0}),"a");const nt=/^[A-Za-z]:\//;function F(r=""){return r&&r.replace(/\\/g,"/").replace(nt,e=>e.toUpperCase())}f(F,"P");p(F,"p");const ot=/^[/\\]{2}/,st=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,ue=/^[A-Za-z]:$/,V=/^\/([A-Za-z]:)?$/,pe=p(function(r){if(r.length===0)return".";r=F(r);let e=r.match(ot),t=D(r),n=r[r.length-1]==="/";return r=R(r,!t),r.length===0?t?"/":n?"./":".":(n&&(r+="/"),ue.test(r)&&(r+="/"),e?t?`//${r}`:`//./${r}`:t&&!D(r)?`/${r}`:r)},"g"),K=p(function(...r){let e="";for(let t of r)if(t)if(e.length>0){let n=e[e.length-1]==="/",o=t[0]==="/";n&&o?e+=t.slice(1):e+=n||o?t:`/${t}`}else e+=t;return pe(e)},"_");function de(){return typeof process.cwd=="function"?process.cwd().replace(/\\/g,"/"):"/"}f(de,"st");p(de,"v");const $=p(function(...r){r=r.map(n=>F(n));let e="",t=!1;for(let n=r.length-1;n>=-1&&!t;n--){let o=n>=0?r[n]:de();!o||o.length===0||(e=`${o}/${e}`,t=D(o))}return e=R(e,!t),t&&!D(e)?`/${e}`:e.length>0?e:"."},"y");function R(r,e){let t="",n=0,o=-1,i=0,c=null;for(let s=0;s<=r.length;++s){if(s<r.length)c=r[s];else{if(c==="/")break;c="/"}if(c==="/"){if(!(o===s-1||i===1))if(i===2){if(t.length<2||n!==2||t[t.length-1]!=="."||t[t.length-2]!=="."){if(t.length>2){let a=t.lastIndexOf("/");a===-1?(t="",n=0):(t=t.slice(0,a),n=t.length-1-t.lastIndexOf("/")),o=s,i=0;continue}else if(t.length>0){t="",n=0,o=s,i=0;continue}}e&&(t+=t.length>0?"/..":"..",n=2)}else t.length>0?t+=`/${r.slice(o+1,s)}`:t=r.slice(o+1,s),n=s-o-1;o=s,i=0}else c==="."&&i!==-1?++i:i=-1}return t}f(R,"W");p(R,"b");const D=p(function(r){return st.test(r)},"x"),he=p(function(r,e){let t=$(r).replace(V,"$1").split("/"),n=$(e).replace(V,"$1").split("/");if(n[0][1]===":"&&t[0][1]===":"&&t[0]!==n[0])return n.join("/");let o=[...t];for(let i of o){if(n[0]!==i)break;t.shift(),n.shift()}return[...t.map(()=>".."),...n].join("/")},"S"),fe=p(function(r){let e=F(r).replace(/\/$/,"").split("/").slice(0,-1);return e.length===1&&ue.test(e[0])&&(e[0]+="/"),e.join("/")||(D(r)?"/":".")},"C"),me=p(function(r,e){let t=F(r).split("/"),n="";for(let o=t.length-1;o>=0;o--){let i=t[o];if(i){n=i;break}}return e&&n.endsWith(e)?n.slice(0,-e.length):n},"ne");var _=p((r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),"w"),O=Me(import.meta.url);const it=/^path$/i,Q={key:"PATH",value:""};function ge(r){for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e)||!it.test(e))continue;let t=r[e];return t?{key:e,value:t}:Q}return Q}f(ge,"pt");p(ge,"D");function we(r,e){let t=e.value.split(q),n=[],o=r,i;do n.push(We(o,"node_modules",".bin")),i=o,o=Xe(o);while(o!==i);let c=n.concat(t).join(q);return{key:e.key,value:c}}f(we,"ut");p(we,"O");function ve(r,e){let t={...process.env,...e},n=we(r,ge(t));return t[n.key]=n.value,t}f(ve,"ft");p(ve,"k");const at=p(r=>{let e=r.length,t=new ae,n=p(()=>{--e===0&&t.emit("end")},"r");for(let o of r)o.pipe(t,{end:!1}),o.on("end",n);return t},"A");var ct=_(((r,e)=>{e.exports=i,i.sync=c;var t=O("fs");function n(s,a){var l=a.pathExt===void 0?process.env.PATHEXT:a.pathExt;if(!l||(l=l.split(";"),l.indexOf("")!==-1))return!0;for(var u=0;u<l.length;u++){var h=l[u].toLowerCase();if(h&&s.substr(-h.length).toLowerCase()===h)return!0}return!1}f(n,"n"),p(n,"r");function o(s,a,l){return!s.isSymbolicLink()&&!s.isFile()?!1:n(a,l)}f(o,"s"),p(o,"i");function i(s,a,l){t.stat(s,function(u,h){l(u,u?!1:o(h,s,a))})}f(i,"i"),p(i,"a");function c(s,a){return o(t.statSync(s),s,a)}f(c,"c"),p(c,"o")})),lt=_(((r,e)=>{e.exports=n,n.sync=o;var t=O("fs");function n(s,a,l){t.stat(s,function(u,h){l(u,u?!1:i(h,a))})}f(n,"n"),p(n,"r");function o(s,a){return i(t.statSync(s),a)}f(o,"s"),p(o,"i");function i(s,a){return s.isFile()&&c(s,a)}f(i,"i"),p(i,"a");function c(s,a){var l=s.mode,u=s.uid,h=s.gid,d=a.uid===void 0?process.getuid&&process.getuid():a.uid,m=a.gid===void 0?process.getgid&&process.getgid():a.gid,g=64,v=8,E=1,S=g|v;return l&E||l&v&&h===m||l&g&&u===d||l&S&&d===0}f(c,"c"),p(c,"o")})),ut=_(((r,e)=>{O("fs");var t=process.platform==="win32"||global.TESTING_WINDOWS?ct():lt();e.exports=n,n.sync=o;function n(i,c,s){if(typeof c=="function"&&(s=c,c={}),!s){if(typeof Promise!="function")throw TypeError("callback not provided");return new Promise(function(a,l){n(i,c||{},function(u,h){u?l(u):a(h)})})}t(i,c||{},function(a,l){a&&(a.code==="EACCES"||c&&c.ignoreErrors)&&(a=null,l=!1),s(a,l)})}f(n,"n"),p(n,"r");function o(i,c){try{return t.sync(i,c||{})}catch(s){if(c&&c.ignoreErrors||s.code==="EACCES")return!1;throw s}}f(o,"s"),p(o,"i")})),pt=_(((r,e)=>{let t=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",n=O("path"),o=t?";":":",i=ut(),c=p(l=>Object.assign(Error(`not found: ${l}`),{code:"ENOENT"}),"o"),s=p((l,u)=>{let h=u.colon||o,d=l.match(/\//)||t&&l.match(/\\/)?[""]:[...t?[process.cwd()]:[],...(u.path||process.env.PATH||"").split(h)],m=t?u.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",g=t?m.split(h):[""];return t&&l.indexOf(".")!==-1&&g[0]!==""&&g.unshift(""),{pathEnv:d,pathExt:g,pathExtExe:m}},"s"),a=p((l,u,h)=>{typeof u=="function"&&(h=u,u={}),u||={};let{pathEnv:d,pathExt:m,pathExtExe:g}=s(l,u),v=[],E=p(b=>new Promise((A,T)=>{if(b===d.length)return u.all&&v.length?A(v):T(c(l));let y=d[b],G=/^".*"$/.test(y)?y.slice(1,-1):y,P=n.join(G,l);A(S(!G&&/^\.[\\\/]/.test(l)?l.slice(0,2)+P:P,b,0))}),"d"),S=p((b,A,T)=>new Promise((y,G)=>{if(T===m.length)return y(E(A+1));let P=m[T];i(b+P,{pathExt:g},(ze,Ie)=>{if(!ze&&Ie)if(u.all)v.push(b+P);else return y(b+P);return y(S(b,A,T+1))})}),"f");return h?E(0).then(b=>h(null,b),h):E(0)},"c");e.exports=a,a.sync=(l,u)=>{u||={};let{pathEnv:h,pathExt:d,pathExtExe:m}=s(l,u),g=[];for(let v=0;v<h.length;v++){let E=h[v],S=/^".*"$/.test(E)?E.slice(1,-1):E,b=n.join(S,l),A=!S&&/^\.[\\\/]/.test(l)?l.slice(0,2)+b:b;for(let T=0;T<d.length;T++){let y=A+d[T];try{if(i.sync(y,{pathExt:m}))if(u.all)g.push(y);else return y}catch{}}}if(u.all&&g.length)return g;if(u.nothrow)return null;throw c(l)}})),dt=_(((r,e)=>{let t=p((n={})=>{let o=n.env||process.env;return(n.platform||process.platform)==="win32"?Object.keys(o).reverse().find(i=>i.toUpperCase()==="PATH")||"Path":"PATH"},"n");e.exports=t,e.exports.default=t})),ht=_(((r,e)=>{let t=O("path"),n=pt(),o=dt();function i(s,a){let l=s.options.env||process.env,u=process.cwd(),h=s.options.cwd!=null,d=h&&process.chdir!==void 0&&!process.chdir.disabled;if(d)try{process.chdir(s.options.cwd)}catch{}let m;try{m=n.sync(s.command,{path:l[o({env:l})],pathExt:a?t.delimiter:void 0})}catch{}finally{d&&process.chdir(u)}return m&&=t.resolve(h?s.options.cwd:"",m),m}f(i,"i"),p(i,"a");function c(s){return i(s)||i(s,!0)}f(c,"c"),p(c,"o"),e.exports=c})),ft=_(((r,e)=>{let t=/([()\][%!^"`<>&|;, *?])/g;function n(i){return i=i.replace(t,"^$1"),i}f(n,"n"),p(n,"r");function o(i,c){return i=`${i}`,i=i.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),i=i.replace(/(?=(\\+?)?)\1$/,"$1$1"),i=`"${i}"`,i=i.replace(t,"^$1"),c&&(i=i.replace(t,"^$1")),i}f(o,"s"),p(o,"i"),e.exports.command=n,e.exports.argument=o})),mt=_(((r,e)=>{e.exports=/^#!(.*)/})),gt=_(((r,e)=>{let t=mt();e.exports=(n="")=>{let o=n.match(t);if(!o)return null;let[i,c]=o[0].replace(/#! ?/,"").split(" "),s=i.split("/").pop();return s==="env"?c:c?`${s} ${c}`:s}})),wt=_(((r,e)=>{let t=O("fs"),n=gt();function o(i){let c=Buffer.alloc(150),s;try{s=t.openSync(i,"r"),t.readSync(s,c,0,150,0),t.closeSync(s)}catch{}return n(c.toString())}f(o,"s"),p(o,"i"),e.exports=o})),vt=_(((r,e)=>{let t=O("path"),n=ht(),o=ft(),i=wt(),c=process.platform==="win32",s=/\.(?:com|exe)$/i,a=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function l(d){d.file=n(d);let m=d.file&&i(d.file);return m?(d.args.unshift(d.file),d.command=m,n(d)):d.file}f(l,"p"),p(l,"l");function u(d){if(!c)return d;let m=l(d),g=!s.test(m);if(d.options.forceShell||g){let v=a.test(m);d.command=t.normalize(d.command),d.command=o.command(d.command),d.args=d.args.map(E=>o.argument(E,v)),d.args=["/d","/s","/c",`"${[d.command].concat(d.args).join(" ")}"`],d.command=process.env.comspec||"cmd.exe",d.options.windowsVerbatimArguments=!0}return d}f(u,"u"),p(u,"u");function h(d,m,g){m&&!Array.isArray(m)&&(g=m,m=null),m=m?m.slice(0):[],g=Object.assign({},g);let v={command:d,args:m,options:g,file:void 0,original:{command:d,args:m}};return g.shell?v:u(v)}f(h,"d"),p(h,"d"),e.exports=h})),$t=_(((r,e)=>{let t=process.platform==="win32";function n(s,a){return Object.assign(Error(`${a} ${s.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${a} ${s.command}`,path:s.command,spawnargs:s.args})}f(n,"n"),p(n,"r");function o(s,a){if(!t)return;let l=s.emit;s.emit=function(u,h){if(u==="exit"){let d=i(h,a);if(d)return l.call(s,"error",d)}return l.apply(s,arguments)}}f(o,"s"),p(o,"i");function i(s,a){return t&&s===1&&!a.file?n(a.original,"spawn"):null}f(i,"i"),p(i,"a");function c(s,a){return t&&s===1&&!a.file?n(a.original,"spawnSync"):null}f(c,"c"),p(c,"o"),e.exports={hookChildProcess:o,verifyENOENT:i,verifyENOENTSync:c,notFoundError:n}})),bt=_(((r,e)=>{let t=O("child_process"),n=vt(),o=$t();function i(s,a,l){let u=n(s,a,l),h=t.spawn(u.command,u.args,u.options);return o.hookChildProcess(h,u),h}f(i,"i"),p(i,"a");function c(s,a,l){let u=n(s,a,l),h=t.spawnSync(u.command,u.args,u.options);return h.error=h.error||o.verifyENOENTSync(h.status,u),h}f(c,"c"),p(c,"o"),e.exports=i,e.exports.spawn=i,e.exports.sync=c,e.exports._parse=n,e.exports._enoent=o}))(),ee=class extends Error{static{f(this,"L")}static{p(this,"U")}result;output;get exitCode(){if(this.result.exitCode!==null)return this.result.exitCode}constructor(r,e){super(`Process exited with non-zero status (${r.exitCode})`),this.result=r,this.output=e}};const _t={timeout:void 0,persist:!1},Et={windowsHide:!0};function $e(r,e){return{command:Je(r),args:e??[]}}f($e,"Pt");p($e,"K");function be(r){let e=new AbortController;for(let t of r){if(t.aborted)return e.abort(),t;t.addEventListener("abort",()=>{e.abort(t.reason)},{signal:e.signal})}return e.signal}f(be,"Tt");p(be,"q");async function B(r){let e="";for await(let t of r)e+=t.toString();return e}f(B,"H");p(B,"J");var yt=class{static{f(this,"At")}static{p(this,"Y")}_process;_aborted=!1;_options;_command;_args;_resolveClose;_processClosed;_thrownError;get process(){return this._process}get pid(){return this._process?.pid}get exitCode(){if(this._process&&this._process.exitCode!==null)return this._process.exitCode}constructor(r,e,t){this._options={..._t,...t},this._command=r,this._args=e??[],this._processClosed=new Promise(n=>{this._resolveClose=n})}kill(r){return this._process?.kill(r)===!0}get aborted(){return this._aborted}get killed(){return this._process?.killed===!0}pipe(r,e,t){return xt(r,e,{...t,stdin:this})}async*[Symbol.asyncIterator](){let r=this._process;if(!r)return;let e=[];this._streamErr&&e.push(this._streamErr),this._streamOut&&e.push(this._streamOut);let t=at(e),n=Ye.createInterface({input:t});for await(let o of n)yield o.toString();if(await this._processClosed,r.removeAllListeners(),this._thrownError)throw this._thrownError;if(this._options?.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new ee(this)}async _waitForOutput(){let r=this._process;if(!r)throw Error("No process was started");let[e,t]=await Promise.all([this._streamOut?B(this._streamOut):"",this._streamErr?B(this._streamErr):""]);if(await this._processClosed,this._options?.stdin&&await this._options.stdin,r.removeAllListeners(),this._thrownError)throw this._thrownError;let n={stderr:t,stdout:e,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new ee(this,n);return n}then(r,e){return this._waitForOutput().then(r,e)}_streamOut;_streamErr;spawn(){let r=qe(),e=this._options,t={...Et,...e.nodeOptions},n=[];this._resetState(),e.timeout!==void 0&&n.push(AbortSignal.timeout(e.timeout)),e.signal!==void 0&&n.push(e.signal),e.persist===!0&&(t.detached=!0),n.length>0&&(t.signal=be(n)),t.env=ve(r,t.env);let{command:o,args:i}=$e(this._command,this._args),c=(0,bt._parse)(o,i,t),s=ce(c.command,c.args,c.options);if(s.stderr&&(this._streamErr=s.stderr),s.stdout&&(this._streamOut=s.stdout),this._process=s,s.once("error",this._onError),s.once("close",this._onClose),e.stdin!==void 0&&s.stdin&&e.stdin.process){let{stdout:a}=e.stdin.process;a&&a.pipe(s.stdin)}}_resetState(){this._aborted=!1,this._processClosed=new Promise(r=>{this._resolveClose=r}),this._thrownError=void 0}_onError=p(r=>{if(r.name==="AbortError"&&(!(r.cause instanceof Error)||r.cause.name!=="TimeoutError")){this._aborted=!0;return}this._thrownError=r},"_onError");_onClose=p(()=>{this._resolveClose&&this._resolveClose()},"_onClose")};const U=p((r,e,t)=>{let n=new yt(r,e,t);return n.spawn(),n},"X"),xt=U;var kt=tt({detectPackageManager:p(()=>W,"detectPackageManager"),installDependencies:p(()=>Te,"installDependencies"),packageManagers:p(()=>j,"packageManagers")});async function _e(r,e,t={}){let n=pe(r).split("/");for(;n.length>0;){let o=await e(n.join("/")||"/");if(o||!t.includeParentDirs)return o;n.pop()}}f(_e,"Mt");p(_e,"se");function Ee(r){let e;return()=>(e===void 0&&(e=r().then(t=>(e=t,e))),e)}f(Ee,"zt");p(Ee,"ce");const Tt=Ee(async()=>{if(globalThis.process?.versions?.webcontainer)return!1;try{let{exitCode:r}=await U("corepack",["--version"]);return r===0}catch{return!1}});async function ye(r,e,t={}){let n=r!=="npm"&&r!=="bun"&&r!=="deno"&&t.corepack!==!1&&await Tt()?["corepack",[r,...e]]:[r,e],{exitCode:o,stdout:i,stderr:c}=await U(n[0],n[1],{nodeOptions:{cwd:$(t.cwd||process.cwd()),env:t.env,stdio:t.silent?"pipe":"inherit"}});if(o!==0)throw Error(`\`${n.flat().join(" ")}\` failed.${t.silent?["",i,c].join(`
|
|
2
|
-
`):""}`)}f(ye,"Lt");p(ye,"le");async function xe(r={}){let e=r.cwd||process.cwd(),t={...process.env,...r.env},n=(typeof r.packageManager=="string"?j.find(o=>o.name===r.packageManager):r.packageManager)||await W(r.cwd||process.cwd());if(!n)throw Error("No package manager auto-detected.");return{cwd:e,env:t,silent:r.silent??!1,packageManager:n,dev:r.dev??!1,workspace:r.workspace,global:r.global??!1,dry:r.dry??!1,corepack:r.corepack??!0}}f(xe,"Ht");p(xe,"ue");function ke(r){let[e,t]=(r||"").split("@"),[n,o]=t?.split("+")||[];if(e&&e!=="-"&&/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(e))return{name:e,version:n,buildMeta:o};let i=(e||"").replace(/\W+/g,"");return{name:i,version:n,buildMeta:o,warnings:[`Abnormal characters found in \`packageManager\` field, sanitizing from \`${e}\` to \`${i}\``]}}f(ke,"Dt");p(ke,"de");const j=[{name:"npm",command:"npm",lockFile:"package-lock.json"},{name:"pnpm",command:"pnpm",lockFile:"pnpm-lock.yaml",files:["pnpm-workspace.yaml"]},{name:"bun",command:"bun",lockFile:["bun.lockb","bun.lock"]},{name:"yarn",command:"yarn",lockFile:"yarn.lock",files:[".yarnrc.yml"]},{name:"deno",command:"deno",lockFile:"deno.lock",files:["deno.json"]}];async function W(r,e={}){let t=await _e($(r||"."),async n=>{if(!e.ignorePackageJSON){let o=K(n,"package.json");if(x(o)){let i=JSON.parse(await ie(o,"utf8"));if(i?.packageManager){let{name:c,version:s="0.0.0",buildMeta:a,warnings:l}=ke(i.packageManager);if(c){let u=s.split(".")[0],h=j.find(d=>d.name===c&&d.majorVersion===u)||j.find(d=>d.name===c);return{name:c,command:c,version:s,majorVersion:u,buildMeta:a,warnings:l,files:h?.files,lockFile:h?.lockFile}}}}if(x(K(n,"deno.json")))return j.find(i=>i.name==="deno")}if(!e.ignoreLockFile){for(let o of j)if([o.lockFile,o.files].flat().filter(Boolean).some(i=>x($(n,i))))return{...o}}},{includeParentDirs:e.includeParentDirs??!0});if(!t&&!e.ignoreArgv){let n=process.argv[1];if(n){for(let o of j)if(RegExp(`[/\\\\]\\.?${o.command}`).test(n))return o}}return t}f(W,"Z$1");p(W,"$");async function Te(r={}){let e=await xe(r),t=r.frozenLockFile?{npm:["ci"],yarn:["install","--immutable"],bun:["install","--frozen-lockfile"],pnpm:["install","--frozen-lockfile"],deno:["install","--frozen"]}[e.packageManager.name]:["install"];return r.ignoreWorkspace&&e.packageManager.name==="pnpm"&&t.push("--ignore-workspace"),e.dry||await ye(e.packageManager.command,t,{cwd:e.cwd,silent:e.silent,corepack:e.corepack}),{exec:{command:e.packageManager.command,args:t}}}f(Te,"It");p(Te,"fe");const Ct=Object.defineProperty({__proto__:null,a:$,i:he,n:me,r:fe,t:kt},Symbol.toStringTag,{value:"Module"});var Ot=Object.defineProperty,w=f((r,e)=>Ot(r,"name",{value:e,configurable:!0}),"o");async function Ce(r,e,t={}){const n=e+".json",o=JSON.parse(await ie(n,"utf8").catch(()=>"{}")),i=(await I(r,{method:"HEAD",headers:t.headers}).catch(()=>{}))?.headers.get("etag");if(o.etag===i&&x(e))return;typeof i=="string"&&(o.etag=i);const c=await I(r,{headers:t.headers});if(c.status>=400)throw new Error(`Failed to download ${r}: ${c.status} ${c.statusText}`);const s=se(e);await Ke(Re)(c.body,s),await Be(n,JSON.stringify(o),"utf8")}f(Ce,"q");w(Ce,"download");const St=/^(?<repo>[-\w.]+\/[-\w.]+)(?<subdir>[^#]+)?(?<ref>#[-\w./@]+)?/,At=/^(?<repo>[-\w.]+(?:\/[-\w.]+)+?)(?:::(?<subdir>[^#]*))?(?<ref>#[-\w./@]+)?$/;function N(r,e){const t=e?.expandRepo||r.includes("::"),n=r.match(t?At:St)?.groups||{},o=t?n.subdir?"/"+n.subdir:"/":n.subdir||"/";return{repo:n.repo||"",subdir:o,ref:n.ref?n.ref.slice(1):"main"}}f(N,"x");w(N,"parseGitURI");function C(...r){process.env.DEBUG&&console.debug("[giget]",...r)}f(C,"$");w(C,"debug");async function I(r,e={}){e.headers?.["sec-fetch-mode"]&&(e.mode=e.headers["sec-fetch-mode"]);const t=await fetch(r,{...e,headers:X(e.headers)}).catch(n=>{throw new Error(`Failed to download ${r}: ${n}`,{cause:n})});if(e.validateStatus&&t.status>=400)throw new Error(`Failed to fetch ${r}: ${t.status} ${t.statusText}`);return t}f(I,"v");w(I,"sendFetch");function Oe(){const r=process.env.XDG_CACHE_HOME?$(process.env.XDG_CACHE_HOME,"giget"):$(Ve(),".cache/giget");if(process.platform==="win32"){const e=$(le(),"giget");if(!x(e)&&x(r))try{He(r,e)}catch{}return e}return r}f(Oe,"ee");w(Oe,"cacheDirectory");function X(r={}){const e={};for(const[t,n]of Object.entries(r))n&&(e[t.toLowerCase()]=n);return e}f(X,"F");w(X,"normalizeHeaders");function Se(){return process.env.SHELL?process.env.SHELL:process.platform==="win32"?"cmd.exe":"/bin/bash"}f(Se,"te");w(Se,"currentShell");function jt(r){r=$(r);const e=Se();console.info(`(experimental) Opening shell in ${he(process.cwd(),r)}...`),Ue(e,[],{cwd:r,shell:!0,stdio:"inherit"})}f(jt,"re");w(jt,"startShell");const Pt=w((r,e)=>{const t=Ae(r);return{name:t.name,version:t.subdir?`${t.version||"default"}-${t.subdir.replaceAll("/","-")}`:t.version,tar:w(({auth:n}={})=>je(t,n??e.auth),"tar")}},"git");function Ae(r,e={}){const t=e.cwd??process.cwd();let n=r.replace(/#.*$/,""),o;if(/^[./]/.test(r))n=$(t,n);else if(/^https?:\/\//.test(n)){const u=/^(https?:\/\/[^/]+)\/([\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/(.+))?$/.exec(n);if(u){const[,h,d,m]=u;n=`${h}/${d}`,m&&(o=m)}}else if(n.includes("@")){const u=/^(.*?:[\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/(.+))?$/.exec(n);if(u){const[,h,d]=u;n=h,d&&(o=d)}}else{const u={"github:":"https://github.com/","gh:":"https://github.com/","gitlab:":"https://gitlab.com/","bitbucket:":"https://bitbucket.org/","sourcehut:":"https://git.sr.ht/~"},h=/^(.+?:)/.exec(n)?.at(1);h&&u[h]?n=n.replace(h,u[h]):h||(n=`${(process.env.GIGET_GIT_HOST||"https://github.com/").replace(/\/$/,"")}/${n}`);const d=/^(https?:\/\/[^/]+\/~?[\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/(.+))?$/.exec(n);if(d){const[,m,g]=d;n=m,g&&(o=g)}}const i=n.replace(/^https?:\/\//,"").replace(/^.+@/,"").replace(/(\.git)?(#.*)?$/,"").replace(/^\W+/,"").replaceAll(/[:/]/g,"-"),[c,s]=/#(.+)$/.exec(r)?.at(1)?.split(":")??[],a=c||void 0,l=s||o;return{uri:n,name:i,...a&&{version:a},...l&&{subdir:l}}}f(Ae,"ie");w(Ae,"parseGitCloneURI");async function je(r,e){const t=await Le(Y(le(),"giget-git-"));if(e&&/[\r\n]/.test(e))throw new Error("Auth token must not contain newline characters");const n={...process.env,GIT_TERMINAL_PROMPT:"0"};e&&(n.GIT_CONFIG_COUNT="1",n.GIT_CONFIG_KEY_0="http.extraHeader",n.GIT_CONFIG_VALUE_0=`Authorization: Bearer ${e}`);const o={env:n,timeout:6e4},i=Pe(),c=w(a=>L(a,o,i),"gitExec"),s=w(a=>L(a,{...o,cwd:t},i),"gitExecIn");try{const a=["clone","--progress","--depth","1"];r.subdir&&a.push("--filter=blob:none","--sparse","--no-checkout"),r.version&&a.push("--branch",r.version),a.push("--",r.uri,t);try{i.update("Cloning..."),await c(a),i.update("Cloned.")}catch(g){if(!r.version)throw g;C("Shallow clone failed, falling back to full clone:",g),i.update("Shallow clone failed, cloning..."),await M(t,{recursive:!0,force:!0}),await H(t,{recursive:!0}),await s(["init"]),await s(["remote","add","origin",r.uri]),await s(["fetch","origin"]),await s(["checkout",r.version]),i.update("Fetched.")}r.subdir&&(i.update(`Sparse checkout ${r.subdir}...`),await s(["sparse-checkout","set",r.subdir]),await s(["checkout"])),i.update("Packing...");const l=r.subdir?Y(t,r.subdir):t,{create:u}=await import("../packem_chunks/tar.js").then(g=>g.t);i.done();const h=u({gzip:!0,cwd:l,filter:w(g=>!g.startsWith(".git/")&&g!==".git"&&!g.startsWith("./.git/")&&g!=="./.git","filter")},["."]).pipe(new ae);let d=!1;const m=w(()=>{d||(d=!0,M(t,{recursive:!0,force:!0}))},"cleanup");return h.on("end",m),h.on("error",m),h.on("close",m),h}catch(a){throw i.done(),await M(t,{recursive:!0,force:!0}),a}}f(je,"se");w(je,"_cloneAndTar");const te=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function L(r,e,t){return new Promise((n,o)=>{const i=ce("git",r,{...e,stdio:["ignore","pipe","pipe"]});i.stdout.resume();let c="";i.stderr?.on("data",s=>{const a=s.toString();for(const l of a.split(/[\r\n]/)){const u=l.trim();u&&(c=u)}t&&t.update(c)}),i.on("close",s=>{s===0?n(c):o(new Error(`git ${r[0]} exited with code ${s}. Is git installed?`))}),i.on("error",s=>{s.code==="ENOENT"?o(new Error("git is not installed or not found in PATH")):o(s)})})}f(L,"G");w(L,"_gitSpawn");function Pe(){if(!process.stderr.isTTY)return{update(o){},done(){}};let r="",e=0;const t=w(()=>{const o=te[e%te.length];e++,process.stderr.write(`\x1B[2K\r\x1B[2m${o} ${r}\x1B[0m`)},"render"),n=setInterval(t,80);return{update(o){r=o,t()},done(){clearInterval(n),process.stderr.write("\x1B[2K\r")}}}f(Pe,"ne");w(Pe,"_createStatus");const re=w(async(r,e)=>{if(r.endsWith(".json"))return await ne(r,e);const t=new URL(r);let n=me(t.pathname);try{const o=await I(t.href,{method:"HEAD",validateStatus:!0,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0}});if((o.headers.get("content-type")||"").includes("application/json"))return await ne(r,e);const i=o.headers.get("content-disposition")?.match(/filename="?(.+)"?/)?.[1];i&&(n=i.split(".")[0])}catch(o){C(`Failed to fetch HEAD for ${t.href}:`,o)}return{name:`${n}-${t.href.slice(0,8)}`,version:"",subdir:"",tar:t.href,defaultDir:n,headers:{Authorization:e.auth?`Bearer ${e.auth}`:void 0}}},"http"),ne=w(async(r,e)=>{const t=await(await I(r,{validateStatus:!0,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0}})).json();if(!t.tar||!t.name)throw new Error(`Invalid template info from ${r}. name or tar fields are missing!`);return t},"_httpJSON"),oe=w((r,e)=>{const t=N(r),n=process.env.GIGET_GITHUB_URL||"https://api.github.com";return{name:t.repo.replace("/","-"),version:t.ref,subdir:t.subdir,headers:{Authorization:e.auth?`Bearer ${e.auth}`:void 0,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},url:`${n.replace("api.github.com","github.com")}/${t.repo}/tree/${t.ref}${t.subdir}`,tar:`${n}/repos/${t.repo}/tarball/${t.ref}`}},"github"),zt=w((r,e)=>{const t=N(r,{expandRepo:!0}),n=process.env.GIGET_GITLAB_URL||"https://gitlab.com";return{name:t.repo.replace("/","-"),version:t.ref,subdir:t.subdir,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0,"sec-fetch-mode":"same-origin"},url:`${n}/${t.repo}/tree/${t.ref}${t.subdir}`,tar:`${n}/${t.repo}/-/archive/${t.ref}.tar.gz`}},"gitlab"),It=w((r,e)=>{const t=N(r);return{name:t.repo.replace("/","-"),version:t.ref,subdir:t.subdir,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0},url:`https://bitbucket.com/${t.repo}/src/${t.ref}${t.subdir}`,tar:`https://bitbucket.org/${t.repo}/get/${t.ref}.tar.gz`}},"bitbucket"),Dt=w((r,e)=>{const t=N(r);return{name:t.repo.replace("/","-"),version:t.ref,subdir:t.subdir,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0},url:`https://git.sr.ht/~${t.repo}/tree/${t.ref}/item${t.subdir}`,tar:`https://git.sr.ht/~${t.repo}/archive/${t.ref}.tar.gz`}},"sourcehut"),Ft={http:re,https:re,git:Pt,github:oe,gh:oe,gitlab:zt,bitbucket:It,sourcehut:Dt},Nt="https://raw.githubusercontent.com/unjs/giget/main/templates",Mt=w((r=Nt,e={})=>(async t=>{const n=Date.now(),o=`${r}/${t}.json`,i=await I(o,{headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0}});if(i.status>=400)throw new Error(`Failed to download ${t} template info from ${o}: ${i.status} ${i.statusText}`);const c=await i.json();if(!c.tar||!c.name)throw new Error(`Invalid template info from ${o}. name or tar fields are missing!`);return C(`Fetched ${t} template info from ${o} in ${Date.now()-n}ms`),c}),"registryProvider"),Gt=/^([\w+-.]+):/;async function Ht(r,e={}){e.registry=process.env.GIGET_REGISTRY??e.registry,e.auth=process.env.GIGET_AUTH??e.auth;const t=e.registry===!1?void 0:Mt(e.registry,{auth:e.auth});let n=e.provider||(t?"registry":"github"),o=r;const i=r.match(Gt);i&&(n=i[1],o=r.slice(i[0].length),(n==="http"||n==="https")&&(o=r)),n.endsWith("+git")&&(o=`${n.slice(0,-4)}:${o}`,n="git");const c=e.providers?.[n]||Ft[n]||t;if(!c)throw new Error(`Unsupported provider: ${n}`);const s=await Promise.resolve().then(()=>c(o,{auth:e.auth})).catch(m=>{throw new Error(`Failed to download template from ${n}: ${m.message}`)});if(!s)throw new Error(`Failed to resolve template from ${n}`);s.name=(s.name||"template").replace(/[^\da-z-]/gi,"-"),s.defaultDir=(s.defaultDir||s.name).replace(/[^\da-z-]/gi,"-");const a=$($(Oe(),n,s.name),(s.version||s.name)+".tar.gz");if(e.preferOffline&&x(a)&&(e.offline=!0),!e.offline){await H(fe(a),{recursive:!0});const m=Date.now();if(typeof s.tar=="function"){const g=s.tar;await(async()=>{const v=await g({auth:e.auth});await Ze(v instanceof J?v:J.fromWeb(v),se(a))})().catch(v=>{if(!x(a))throw v;C("Download error. Using cached version:",v),e.offline=!0})}else await Ce(s.tar,a,{headers:{Authorization:e.auth?`Bearer ${e.auth}`:void 0,...X(s.headers)}}).catch(g=>{if(!x(a))throw g;C("Download error. Using cached version:",g),e.offline=!0});C(`Downloaded to ${a} in ${Date.now()-m}ms`)}if(!x(a))throw new Error(`Tarball not found: ${a} (offline: ${e.offline})`);const l=$($(e.cwd||"."),e.dir||s.defaultDir);if(e.forceClean&&await M(l,{recursive:!0,force:!0}),!e.force&&x(l)&&Ge(l).length>0)throw new Error(`Destination ${l} already exists.`);await H(l,{recursive:!0});const u=Date.now(),h=s.subdir?.replace(/^\//,"")||"",{extract:d}=await import("../packem_chunks/tar.js").then(m=>m.t);if(await d({file:a,cwd:l,onReadEntry(m){m.path=m.path.split("/").splice(1).join("/"),h&&(m.path.startsWith(h+"/")?m.path=m.path.slice(h.length):m.path="")}}),C(`Extracted to ${l} in ${Date.now()-u}ms`),e.install){C("Installing dependencies...");const{installDependencies:m}=await Promise.resolve().then(()=>Ct).then(g=>g.t);await m({cwd:l,silent:e.silent,...typeof e.install=="object"?e.install:{}})}return{...s,source:o,dir:l}}f(Ht,"fe");w(Ht,"downloadTemplate");export{Ht as f,tt as p};
|
|
1
|
+
var De=Object.defineProperty;var f=(r,e)=>De(r,"name",{value:e,configurable:!0});import{createRequire as Fe}from"node:module";const Ne=Fe(import.meta.url),z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=f(r=>{if(typeof z<"u"&&z.versions&&z.versions.node){const[e,t]=z.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return z.getBuiltinModule(r)}return Ne(r)},"__cjs_getBuiltinModule"),{createRequire:Me}=k("node:module"),{existsSync:x,createWriteStream:se,readdirSync:Ge,renameSync:He}=k("node:fs"),{readFile:ie,mkdir:H,rm:M,writeFile:Be,mkdtemp:Le}=k("node:fs/promises"),{PassThrough:ae,Readable:q,pipeline:Re}=k("node:stream"),{spawn:ce,spawnSync:Ue}=k("node:child_process"),{delimiter:J,resolve:We,dirname:Xe,normalize:qe,join:Y}=k("node:path"),{cwd:Je}=z,Ye=k("node:readline"),{pipeline:Ze}=k("node:stream/promises"),{homedir:Ve,tmpdir:le}=k("node:os"),{promisify:Ke}=k("node:util");var Qe=Object.defineProperty,et=f((r,e)=>Qe(r,"name",{value:e,configurable:!0}),"a$1"),Z=Object.defineProperty,tt=et((r,e)=>{let t={};for(var n in r)Z(t,n,{get:r[n],enumerable:!0});return e||Z(t,Symbol.toStringTag,{value:"Module"}),t},"__exportAll"),rt=Object.defineProperty,p=f((r,e)=>rt(r,"name",{value:e,configurable:!0}),"a");const nt=/^[A-Za-z]:\//;function F(r=""){return r&&r.replace(/\\/g,"/").replace(nt,e=>e.toUpperCase())}f(F,"P");p(F,"p");const ot=/^[/\\]{2}/,st=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,ue=/^[A-Za-z]:$/,V=/^\/([A-Za-z]:)?$/,pe=p(function(r){if(r.length===0)return".";r=F(r);let e=r.match(ot),t=D(r),n=r[r.length-1]==="/";return r=R(r,!t),r.length===0?t?"/":n?"./":".":(n&&(r+="/"),ue.test(r)&&(r+="/"),e?t?`//${r}`:`//./${r}`:t&&!D(r)?`/${r}`:r)},"g"),K=p(function(...r){let e="";for(let t of r)if(t)if(e.length>0){let n=e[e.length-1]==="/",o=t[0]==="/";n&&o?e+=t.slice(1):e+=n||o?t:`/${t}`}else e+=t;return pe(e)},"_");function de(){return typeof process.cwd=="function"?process.cwd().replace(/\\/g,"/"):"/"}f(de,"st");p(de,"v");const $=p(function(...r){r=r.map(n=>F(n));let e="",t=!1;for(let n=r.length-1;n>=-1&&!t;n--){let o=n>=0?r[n]:de();!o||o.length===0||(e=`${o}/${e}`,t=D(o))}return e=R(e,!t),t&&!D(e)?`/${e}`:e.length>0?e:"."},"y");function R(r,e){let t="",n=0,o=-1,i=0,c=null;for(let s=0;s<=r.length;++s){if(s<r.length)c=r[s];else{if(c==="/")break;c="/"}if(c==="/"){if(!(o===s-1||i===1))if(i===2){if(t.length<2||n!==2||t[t.length-1]!=="."||t[t.length-2]!=="."){if(t.length>2){let a=t.lastIndexOf("/");a===-1?(t="",n=0):(t=t.slice(0,a),n=t.length-1-t.lastIndexOf("/")),o=s,i=0;continue}else if(t.length>0){t="",n=0,o=s,i=0;continue}}e&&(t+=t.length>0?"/..":"..",n=2)}else t.length>0?t+=`/${r.slice(o+1,s)}`:t=r.slice(o+1,s),n=s-o-1;o=s,i=0}else c==="."&&i!==-1?++i:i=-1}return t}f(R,"W");p(R,"b");const D=p(function(r){return st.test(r)},"x"),he=p(function(r,e){let t=$(r).replace(V,"$1").split("/"),n=$(e).replace(V,"$1").split("/");if(n[0][1]===":"&&t[0][1]===":"&&t[0]!==n[0])return n.join("/");let o=[...t];for(let i of o){if(n[0]!==i)break;t.shift(),n.shift()}return[...t.map(()=>".."),...n].join("/")},"S"),fe=p(function(r){let e=F(r).replace(/\/$/,"").split("/").slice(0,-1);return e.length===1&&ue.test(e[0])&&(e[0]+="/"),e.join("/")||(D(r)?"/":".")},"C"),me=p(function(r,e){let t=F(r).split("/"),n="";for(let o=t.length-1;o>=0;o--){let i=t[o];if(i){n=i;break}}return e&&n.endsWith(e)?n.slice(0,-e.length):n},"ne");var _=p((r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),"w"),O=Me(import.meta.url);const it=/^path$/i,Q={key:"PATH",value:""};function ge(r){for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e)||!it.test(e))continue;let t=r[e];return t?{key:e,value:t}:Q}return Q}f(ge,"pt");p(ge,"D");function we(r,e){let t=e.value.split(J),n=[],o=r,i;do n.push(We(o,"node_modules",".bin")),i=o,o=Xe(o);while(o!==i);let c=n.concat(t).join(J);return{key:e.key,value:c}}f(we,"ut");p(we,"O");function ve(r,e){let t={...process.env,...e},n=we(r,ge(t));return t[n.key]=n.value,t}f(ve,"ft");p(ve,"k");const at=p(r=>{let e=r.length,t=new ae,n=p(()=>{--e===0&&t.emit("end")},"r");for(let o of r)o.pipe(t,{end:!1}),o.on("end",n);return t},"A");var ct=_(((r,e)=>{e.exports=i,i.sync=c;var t=O("fs");function n(s,a){var l=a.pathExt===void 0?process.env.PATHEXT:a.pathExt;if(!l||(l=l.split(";"),l.indexOf("")!==-1))return!0;for(var u=0;u<l.length;u++){var h=l[u].toLowerCase();if(h&&s.substr(-h.length).toLowerCase()===h)return!0}return!1}f(n,"n"),p(n,"r");function o(s,a,l){return!s.isSymbolicLink()&&!s.isFile()?!1:n(a,l)}f(o,"s"),p(o,"i");function i(s,a,l){t.stat(s,function(u,h){l(u,u?!1:o(h,s,a))})}f(i,"i"),p(i,"a");function c(s,a){return o(t.statSync(s),s,a)}f(c,"c"),p(c,"o")})),lt=_(((r,e)=>{e.exports=n,n.sync=o;var t=O("fs");function n(s,a,l){t.stat(s,function(u,h){l(u,u?!1:i(h,a))})}f(n,"n"),p(n,"r");function o(s,a){return i(t.statSync(s),a)}f(o,"s"),p(o,"i");function i(s,a){return s.isFile()&&c(s,a)}f(i,"i"),p(i,"a");function c(s,a){var l=s.mode,u=s.uid,h=s.gid,d=a.uid===void 0?process.getuid&&process.getuid():a.uid,m=a.gid===void 0?process.getgid&&process.getgid():a.gid,g=64,v=8,E=1,S=g|v;return l&E||l&v&&h===m||l&g&&u===d||l&S&&d===0}f(c,"c"),p(c,"o")})),ut=_(((r,e)=>{O("fs");var t=process.platform==="win32"||global.TESTING_WINDOWS?ct():lt();e.exports=n,n.sync=o;function n(i,c,s){if(typeof c=="function"&&(s=c,c={}),!s){if(typeof Promise!="function")throw TypeError("callback not provided");return new Promise(function(a,l){n(i,c||{},function(u,h){u?l(u):a(h)})})}t(i,c||{},function(a,l){a&&(a.code==="EACCES"||c&&c.ignoreErrors)&&(a=null,l=!1),s(a,l)})}f(n,"n"),p(n,"r");function o(i,c){try{return t.sync(i,c||{})}catch(s){if(c&&c.ignoreErrors||s.code==="EACCES")return!1;throw s}}f(o,"s"),p(o,"i")})),pt=_(((r,e)=>{let t=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",n=O("path"),o=t?";":":",i=ut(),c=p(l=>Object.assign(Error(`not found: ${l}`),{code:"ENOENT"}),"o"),s=p((l,u)=>{let h=u.colon||o,d=l.match(/\//)||t&&l.match(/\\/)?[""]:[...t?[process.cwd()]:[],...(u.path||process.env.PATH||"").split(h)],m=t?u.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",g=t?m.split(h):[""];return t&&l.indexOf(".")!==-1&&g[0]!==""&&g.unshift(""),{pathEnv:d,pathExt:g,pathExtExe:m}},"s"),a=p((l,u,h)=>{typeof u=="function"&&(h=u,u={}),u||={};let{pathEnv:d,pathExt:m,pathExtExe:g}=s(l,u),v=[],E=p(b=>new Promise((A,T)=>{if(b===d.length)return u.all&&v.length?A(v):T(c(l));let y=d[b],G=/^".*"$/.test(y)?y.slice(1,-1):y,P=n.join(G,l);A(S(!G&&/^\.[\\\/]/.test(l)?l.slice(0,2)+P:P,b,0))}),"d"),S=p((b,A,T)=>new Promise((y,G)=>{if(T===m.length)return y(E(A+1));let P=m[T];i(b+P,{pathExt:g},(ze,Ie)=>{if(!ze&&Ie)if(u.all)v.push(b+P);else return y(b+P);return y(S(b,A,T+1))})}),"f");return h?E(0).then(b=>h(null,b),h):E(0)},"c");e.exports=a,a.sync=(l,u)=>{u||={};let{pathEnv:h,pathExt:d,pathExtExe:m}=s(l,u),g=[];for(let v=0;v<h.length;v++){let E=h[v],S=/^".*"$/.test(E)?E.slice(1,-1):E,b=n.join(S,l),A=!S&&/^\.[\\\/]/.test(l)?l.slice(0,2)+b:b;for(let T=0;T<d.length;T++){let y=A+d[T];try{if(i.sync(y,{pathExt:m}))if(u.all)g.push(y);else return y}catch{}}}if(u.all&&g.length)return g;if(u.nothrow)return null;throw c(l)}})),dt=_(((r,e)=>{let t=p((n={})=>{let o=n.env||process.env;return(n.platform||process.platform)==="win32"?Object.keys(o).reverse().find(i=>i.toUpperCase()==="PATH")||"Path":"PATH"},"n");e.exports=t,e.exports.default=t})),ht=_(((r,e)=>{let t=O("path"),n=pt(),o=dt();function i(s,a){let l=s.options.env||process.env,u=process.cwd(),h=s.options.cwd!=null,d=h&&process.chdir!==void 0&&!process.chdir.disabled;if(d)try{process.chdir(s.options.cwd)}catch{}let m;try{m=n.sync(s.command,{path:l[o({env:l})],pathExt:a?t.delimiter:void 0})}catch{}finally{d&&process.chdir(u)}return m&&=t.resolve(h?s.options.cwd:"",m),m}f(i,"i"),p(i,"a");function c(s){return i(s)||i(s,!0)}f(c,"c"),p(c,"o"),e.exports=c})),ft=_(((r,e)=>{let t=/([()\][%!^"`<>&|;, *?])/g;function n(i){return i=i.replace(t,"^$1"),i}f(n,"n"),p(n,"r");function o(i,c){return i=`${i}`,i=i.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),i=i.replace(/(?=(\\+?)?)\1$/,"$1$1"),i=`"${i}"`,i=i.replace(t,"^$1"),c&&(i=i.replace(t,"^$1")),i}f(o,"s"),p(o,"i"),e.exports.command=n,e.exports.argument=o})),mt=_(((r,e)=>{e.exports=/^#!(.*)/})),gt=_(((r,e)=>{let t=mt();e.exports=(n="")=>{let o=n.match(t);if(!o)return null;let[i,c]=o[0].replace(/#! ?/,"").split(" "),s=i.split("/").pop();return s==="env"?c:c?`${s} ${c}`:s}})),wt=_(((r,e)=>{let t=O("fs"),n=gt();function o(i){let c=Buffer.alloc(150),s;try{s=t.openSync(i,"r"),t.readSync(s,c,0,150,0),t.closeSync(s)}catch{}return n(c.toString())}f(o,"s"),p(o,"i"),e.exports=o})),vt=_(((r,e)=>{let t=O("path"),n=ht(),o=ft(),i=wt(),c=process.platform==="win32",s=/\.(?:com|exe)$/i,a=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function l(d){d.file=n(d);let m=d.file&&i(d.file);return m?(d.args.unshift(d.file),d.command=m,n(d)):d.file}f(l,"p"),p(l,"l");function u(d){if(!c)return d;let m=l(d),g=!s.test(m);if(d.options.forceShell||g){let v=a.test(m);d.command=t.normalize(d.command),d.command=o.command(d.command),d.args=d.args.map(E=>o.argument(E,v)),d.args=["/d","/s","/c",`"${[d.command].concat(d.args).join(" ")}"`],d.command=process.env.comspec||"cmd.exe",d.options.windowsVerbatimArguments=!0}return d}f(u,"u"),p(u,"u");function h(d,m,g){m&&!Array.isArray(m)&&(g=m,m=null),m=m?m.slice(0):[],g=Object.assign({},g);let v={command:d,args:m,options:g,file:void 0,original:{command:d,args:m}};return g.shell?v:u(v)}f(h,"d"),p(h,"d"),e.exports=h})),$t=_(((r,e)=>{let t=process.platform==="win32";function n(s,a){return Object.assign(Error(`${a} ${s.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${a} ${s.command}`,path:s.command,spawnargs:s.args})}f(n,"n"),p(n,"r");function o(s,a){if(!t)return;let l=s.emit;s.emit=function(u,h){if(u==="exit"){let d=i(h,a);if(d)return l.call(s,"error",d)}return l.apply(s,arguments)}}f(o,"s"),p(o,"i");function i(s,a){return t&&s===1&&!a.file?n(a.original,"spawn"):null}f(i,"i"),p(i,"a");function c(s,a){return t&&s===1&&!a.file?n(a.original,"spawnSync"):null}f(c,"c"),p(c,"o"),e.exports={hookChildProcess:o,verifyENOENT:i,verifyENOENTSync:c,notFoundError:n}})),bt=_(((r,e)=>{let t=O("child_process"),n=vt(),o=$t();function i(s,a,l){let u=n(s,a,l),h=t.spawn(u.command,u.args,u.options);return o.hookChildProcess(h,u),h}f(i,"i"),p(i,"a");function c(s,a,l){let u=n(s,a,l),h=t.spawnSync(u.command,u.args,u.options);return h.error=h.error||o.verifyENOENTSync(h.status,u),h}f(c,"c"),p(c,"o"),e.exports=i,e.exports.spawn=i,e.exports.sync=c,e.exports._parse=n,e.exports._enoent=o}))(),ee=class extends Error{static{f(this,"L")}static{p(this,"U")}result;output;get exitCode(){if(this.result.exitCode!==null)return this.result.exitCode}constructor(r,e){super(`Process exited with non-zero status (${r.exitCode})`),this.result=r,this.output=e}};const _t={timeout:void 0,persist:!1},Et={windowsHide:!0};function $e(r,e){return{command:qe(r),args:e??[]}}f($e,"Pt");p($e,"K");function be(r){let e=new AbortController;for(let t of r){if(t.aborted)return e.abort(),t;t.addEventListener("abort",()=>{e.abort(t.reason)},{signal:e.signal})}return e.signal}f(be,"Tt");p(be,"q");async function B(r){let e="";for await(let t of r)e+=t.toString();return e}f(B,"H");p(B,"J");var yt=class{static{f(this,"At")}static{p(this,"Y")}_process;_aborted=!1;_options;_command;_args;_resolveClose;_processClosed;_thrownError;get process(){return this._process}get pid(){return this._process?.pid}get exitCode(){if(this._process&&this._process.exitCode!==null)return this._process.exitCode}constructor(r,e,t){this._options={..._t,...t},this._command=r,this._args=e??[],this._processClosed=new Promise(n=>{this._resolveClose=n})}kill(r){return this._process?.kill(r)===!0}get aborted(){return this._aborted}get killed(){return this._process?.killed===!0}pipe(r,e,t){return xt(r,e,{...t,stdin:this})}async*[Symbol.asyncIterator](){let r=this._process;if(!r)return;let e=[];this._streamErr&&e.push(this._streamErr),this._streamOut&&e.push(this._streamOut);let t=at(e),n=Ye.createInterface({input:t});for await(let o of n)yield o.toString();if(await this._processClosed,r.removeAllListeners(),this._thrownError)throw this._thrownError;if(this._options?.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new ee(this)}async _waitForOutput(){let r=this._process;if(!r)throw Error("No process was started");let[e,t]=await Promise.all([this._streamOut?B(this._streamOut):"",this._streamErr?B(this._streamErr):""]);if(await this._processClosed,this._options?.stdin&&await this._options.stdin,r.removeAllListeners(),this._thrownError)throw this._thrownError;let n={stderr:t,stdout:e,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new ee(this,n);return n}then(r,e){return this._waitForOutput().then(r,e)}_streamOut;_streamErr;spawn(){let r=Je(),e=this._options,t={...Et,...e.nodeOptions},n=[];this._resetState(),e.timeout!==void 0&&n.push(AbortSignal.timeout(e.timeout)),e.signal!==void 0&&n.push(e.signal),e.persist===!0&&(t.detached=!0),n.length>0&&(t.signal=be(n)),t.env=ve(r,t.env);let{command:o,args:i}=$e(this._command,this._args),c=(0,bt._parse)(o,i,t),s=ce(c.command,c.args,c.options);if(s.stderr&&(this._streamErr=s.stderr),s.stdout&&(this._streamOut=s.stdout),this._process=s,s.once("error",this._onError),s.once("close",this._onClose),e.stdin!==void 0&&s.stdin&&e.stdin.process){let{stdout:a}=e.stdin.process;a&&a.pipe(s.stdin)}}_resetState(){this._aborted=!1,this._processClosed=new Promise(r=>{this._resolveClose=r}),this._thrownError=void 0}_onError=p(r=>{if(r.name==="AbortError"&&(!(r.cause instanceof Error)||r.cause.name!=="TimeoutError")){this._aborted=!0;return}this._thrownError=r},"_onError");_onClose=p(()=>{this._resolveClose&&this._resolveClose()},"_onClose")};const U=p((r,e,t)=>{let n=new yt(r,e,t);return n.spawn(),n},"X"),xt=U;var kt=tt({detectPackageManager:p(()=>W,"detectPackageManager"),installDependencies:p(()=>Te,"installDependencies"),packageManagers:p(()=>j,"packageManagers")});async function _e(r,e,t={}){let n=pe(r).split("/");for(;n.length>0;){let o=await e(n.join("/")||"/");if(o||!t.includeParentDirs)return o;n.pop()}}f(_e,"Mt");p(_e,"se");function Ee(r){let e;return()=>(e===void 0&&(e=r().then(t=>(e=t,e))),e)}f(Ee,"zt");p(Ee,"ce");const Tt=Ee(async()=>{if(globalThis.process?.versions?.webcontainer)return!1;try{let{exitCode:r}=await U("corepack",["--version"]);return r===0}catch{return!1}});async function ye(r,e,t={}){let n=r!=="npm"&&r!=="bun"&&r!=="deno"&&t.corepack!==!1&&await Tt()?["corepack",[r,...e]]:[r,e],{exitCode:o,stdout:i,stderr:c}=await U(n[0],n[1],{nodeOptions:{cwd:$(t.cwd||process.cwd()),env:t.env,stdio:t.silent?"pipe":"inherit"}});if(o!==0)throw Error(`\`${n.flat().join(" ")}\` failed.${t.silent?["",i,c].join(`
|
|
2
|
+
`):""}`)}f(ye,"Lt");p(ye,"le");async function xe(r={}){let e=r.cwd||process.cwd(),t={...process.env,...r.env},n=(typeof r.packageManager=="string"?j.find(o=>o.name===r.packageManager):r.packageManager)||await W(r.cwd||process.cwd());if(!n)throw Error("No package manager auto-detected.");return{cwd:e,env:t,silent:r.silent??!1,packageManager:n,dev:r.dev??!1,workspace:r.workspace,global:r.global??!1,dry:r.dry??!1,corepack:r.corepack??!0}}f(xe,"Ht");p(xe,"ue");function ke(r){let[e,t]=(r||"").split("@"),[n,o]=t?.split("+")||[];if(e&&e!=="-"&&/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(e))return{name:e,version:n,buildMeta:o};let i=(e||"").replace(/\W+/g,"");return{name:i,version:n,buildMeta:o,warnings:[`Abnormal characters found in \`packageManager\` field, sanitizing from \`${e}\` to \`${i}\``]}}f(ke,"Dt");p(ke,"de");const j=[{name:"npm",command:"npm",lockFile:"package-lock.json"},{name:"pnpm",command:"pnpm",lockFile:"pnpm-lock.yaml",files:["pnpm-workspace.yaml"]},{name:"bun",command:"bun",lockFile:["bun.lockb","bun.lock"]},{name:"yarn",command:"yarn",lockFile:"yarn.lock",files:[".yarnrc.yml"]},{name:"deno",command:"deno",lockFile:"deno.lock",files:["deno.json"]}];async function W(r,e={}){let t=await _e($(r||"."),async n=>{if(!e.ignorePackageJSON){let o=K(n,"package.json");if(x(o)){let i=JSON.parse(await ie(o,"utf8"));if(i?.packageManager){let{name:c,version:s="0.0.0",buildMeta:a,warnings:l}=ke(i.packageManager);if(c){let u=s.split(".")[0],h=j.find(d=>d.name===c&&d.majorVersion===u)||j.find(d=>d.name===c);return{name:c,command:c,version:s,majorVersion:u,buildMeta:a,warnings:l,files:h?.files,lockFile:h?.lockFile}}}}if(x(K(n,"deno.json")))return j.find(i=>i.name==="deno")}if(!e.ignoreLockFile){for(let o of j)if([o.lockFile,o.files].flat().filter(Boolean).some(i=>x($(n,i))))return{...o}}},{includeParentDirs:e.includeParentDirs??!0});if(!t&&!e.ignoreArgv){let n=process.argv[1];if(n){for(let o of j)if(RegExp(`[/\\\\]\\.?${o.command}`).test(n))return o}}return t}f(W,"Z$1");p(W,"$");async function Te(r={}){let e=await xe(r),t=r.frozenLockFile?{npm:["ci"],yarn:["install","--immutable"],bun:["install","--frozen-lockfile"],pnpm:["install","--frozen-lockfile"],deno:["install","--frozen"]}[e.packageManager.name]:["install"];return r.ignoreWorkspace&&e.packageManager.name==="pnpm"&&t.push("--ignore-workspace"),e.dry||await ye(e.packageManager.command,t,{cwd:e.cwd,silent:e.silent,corepack:e.corepack}),{exec:{command:e.packageManager.command,args:t}}}f(Te,"It");p(Te,"fe");const Ct=Object.defineProperty({__proto__:null,a:$,i:he,n:me,r:fe,t:kt},Symbol.toStringTag,{value:"Module"});var Ot=Object.defineProperty,w=f((r,e)=>Ot(r,"name",{value:e,configurable:!0}),"o");async function Ce(r,e,t={}){const n=e+".json",o=JSON.parse(await ie(n,"utf8").catch(()=>"{}")),i=(await I(r,{method:"HEAD",headers:t.headers}).catch(()=>{}))?.headers.get("etag");if(o.etag===i&&x(e))return;typeof i=="string"&&(o.etag=i);const c=await I(r,{headers:t.headers});if(c.status>=400)throw new Error(`Failed to download ${r}: ${c.status} ${c.statusText}`);const s=se(e);await Ke(Re)(c.body,s),await Be(n,JSON.stringify(o),"utf8")}f(Ce,"q");w(Ce,"download");const St=/^(?<repo>[-\w.]+\/[-\w.]+)(?<subdir>[^#]+)?(?<ref>#[-\w./@]+)?/,At=/^(?<repo>[-\w.]+(?:\/[-\w.]+)+?)(?:::(?<subdir>[^#]*))?(?<ref>#[-\w./@]+)?$/;function N(r,e){const t=e?.expandRepo||r.includes("::"),n=r.match(t?At:St)?.groups||{},o=t?n.subdir?"/"+n.subdir:"/":n.subdir||"/";return{repo:n.repo||"",subdir:o,ref:n.ref?n.ref.slice(1):"main"}}f(N,"x");w(N,"parseGitURI");function C(...r){process.env.DEBUG&&console.debug("[giget]",...r)}f(C,"$");w(C,"debug");async function I(r,e={}){e.headers?.["sec-fetch-mode"]&&(e.mode=e.headers["sec-fetch-mode"]);const t=await fetch(r,{...e,headers:X(e.headers)}).catch(n=>{throw new Error(`Failed to download ${r}: ${n}`,{cause:n})});if(e.validateStatus&&t.status>=400)throw new Error(`Failed to fetch ${r}: ${t.status} ${t.statusText}`);return t}f(I,"v");w(I,"sendFetch");function Oe(){const r=process.env.XDG_CACHE_HOME?$(process.env.XDG_CACHE_HOME,"giget"):$(Ve(),".cache/giget");if(process.platform==="win32"){const e=$(le(),"giget");if(!x(e)&&x(r))try{He(r,e)}catch{}return e}return r}f(Oe,"ee");w(Oe,"cacheDirectory");function X(r={}){const e={};for(const[t,n]of Object.entries(r))n&&(e[t.toLowerCase()]=n);return e}f(X,"F");w(X,"normalizeHeaders");function Se(){return process.env.SHELL?process.env.SHELL:process.platform==="win32"?"cmd.exe":"/bin/bash"}f(Se,"te");w(Se,"currentShell");function jt(r){r=$(r);const e=Se();console.info(`(experimental) Opening shell in ${he(process.cwd(),r)}...`),Ue(e,[],{cwd:r,shell:!0,stdio:"inherit"})}f(jt,"re");w(jt,"startShell");const Pt=w((r,e)=>{const t=Ae(r);return{name:t.name,version:t.subdir?`${t.version||"default"}-${t.subdir.replaceAll("/","-")}`:t.version,tar:w(({auth:n}={})=>je(t,n??e.auth),"tar")}},"git");function Ae(r,e={}){const t=e.cwd??process.cwd();let n=r.replace(/#.*$/,""),o;if(/^[./]/.test(r))n=$(t,n);else if(/^https?:\/\//.test(n)){const u=/^(https?:\/\/[^/]+)\/([\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/(.+))?$/.exec(n);if(u){const[,h,d,m]=u;n=`${h}/${d}`,m&&(o=m)}}else if(n.includes("@")){const u=/^(.*?:[\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/(.+))?$/.exec(n);if(u){const[,h,d]=u;n=h,d&&(o=d)}}else{const u={"github:":"https://github.com/","gh:":"https://github.com/","gitlab:":"https://gitlab.com/","bitbucket:":"https://bitbucket.org/","sourcehut:":"https://git.sr.ht/~"},h=/^(.+?:)/.exec(n)?.at(1);h&&u[h]?n=n.replace(h,u[h]):h||(n=`${(process.env.GIGET_GIT_HOST||"https://github.com/").replace(/\/$/,"")}/${n}`);const d=/^(https?:\/\/[^/]+\/~?[\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/(.+))?$/.exec(n);if(d){const[,m,g]=d;n=m,g&&(o=g)}}const i=n.replace(/^https?:\/\//,"").replace(/^.+@/,"").replace(/(\.git)?(#.*)?$/,"").replace(/^\W+/,"").replaceAll(/[:/]/g,"-"),[c,s]=/#(.+)$/.exec(r)?.at(1)?.split(":")??[],a=c||void 0,l=s||o;return{uri:n,name:i,...a&&{version:a},...l&&{subdir:l}}}f(Ae,"ie");w(Ae,"parseGitCloneURI");async function je(r,e){const t=await Le(Y(le(),"giget-git-"));if(e&&/[\r\n]/.test(e))throw new Error("Auth token must not contain newline characters");const n={...process.env,GIT_TERMINAL_PROMPT:"0"};e&&(n.GIT_CONFIG_COUNT="1",n.GIT_CONFIG_KEY_0="http.extraHeader",n.GIT_CONFIG_VALUE_0=`Authorization: Bearer ${e}`);const o={env:n,timeout:6e4},i=Pe(),c=w(a=>L(a,o,i),"gitExec"),s=w(a=>L(a,{...o,cwd:t},i),"gitExecIn");try{const a=["clone","--progress","--depth","1"];r.subdir&&a.push("--filter=blob:none","--sparse","--no-checkout"),r.version&&a.push("--branch",r.version),a.push("--",r.uri,t);try{i.update("Cloning..."),await c(a),i.update("Cloned.")}catch(g){if(!r.version)throw g;C("Shallow clone failed, falling back to full clone:",g),i.update("Shallow clone failed, cloning..."),await M(t,{recursive:!0,force:!0}),await H(t,{recursive:!0}),await s(["init"]),await s(["remote","add","origin",r.uri]),await s(["fetch","origin"]),await s(["checkout",r.version]),i.update("Fetched.")}r.subdir&&(i.update(`Sparse checkout ${r.subdir}...`),await s(["sparse-checkout","set",r.subdir]),await s(["checkout"])),i.update("Packing...");const l=r.subdir?Y(t,r.subdir):t,{create:u}=await import("../packem_chunks/tar.js").then(g=>g.t);i.done();const h=u({gzip:!0,cwd:l,filter:w(g=>!g.startsWith(".git/")&&g!==".git"&&!g.startsWith("./.git/")&&g!=="./.git","filter")},["."]).pipe(new ae);let d=!1;const m=w(()=>{d||(d=!0,M(t,{recursive:!0,force:!0}))},"cleanup");return h.on("end",m),h.on("error",m),h.on("close",m),h}catch(a){throw i.done(),await M(t,{recursive:!0,force:!0}),a}}f(je,"se");w(je,"_cloneAndTar");const te=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function L(r,e,t){return new Promise((n,o)=>{const i=ce("git",r,{...e,stdio:["ignore","pipe","pipe"]});i.stdout.resume();let c="";i.stderr?.on("data",s=>{const a=s.toString();for(const l of a.split(/[\r\n]/)){const u=l.trim();u&&(c=u)}t&&t.update(c)}),i.on("close",s=>{s===0?n(c):o(new Error(`git ${r[0]} exited with code ${s}. Is git installed?`))}),i.on("error",s=>{s.code==="ENOENT"?o(new Error("git is not installed or not found in PATH")):o(s)})})}f(L,"G");w(L,"_gitSpawn");function Pe(){if(!process.stderr.isTTY)return{update(o){},done(){}};let r="",e=0;const t=w(()=>{const o=te[e%te.length];e++,process.stderr.write(`\x1B[2K\r\x1B[2m${o} ${r}\x1B[0m`)},"render"),n=setInterval(t,80);return{update(o){r=o,t()},done(){clearInterval(n),process.stderr.write("\x1B[2K\r")}}}f(Pe,"ne");w(Pe,"_createStatus");const re=w(async(r,e)=>{if(r.endsWith(".json"))return await ne(r,e);const t=new URL(r);let n=me(t.pathname);try{const o=await I(t.href,{method:"HEAD",validateStatus:!0,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0}});if((o.headers.get("content-type")||"").includes("application/json"))return await ne(r,e);const i=o.headers.get("content-disposition")?.match(/filename="?(.+)"?/)?.[1];i&&(n=i.split(".")[0])}catch(o){C(`Failed to fetch HEAD for ${t.href}:`,o)}return{name:`${n}-${t.href.slice(0,8)}`,version:"",subdir:"",tar:t.href,defaultDir:n,headers:{Authorization:e.auth?`Bearer ${e.auth}`:void 0}}},"http"),ne=w(async(r,e)=>{const t=await(await I(r,{validateStatus:!0,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0}})).json();if(!t.tar||!t.name)throw new Error(`Invalid template info from ${r}. name or tar fields are missing!`);return t},"_httpJSON"),oe=w((r,e)=>{const t=N(r),n=process.env.GIGET_GITHUB_URL||"https://api.github.com";return{name:t.repo.replace("/","-"),version:t.ref,subdir:t.subdir,headers:{Authorization:e.auth?`Bearer ${e.auth}`:void 0,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},url:`${n.replace("api.github.com","github.com")}/${t.repo}/tree/${t.ref}${t.subdir}`,tar:`${n}/repos/${t.repo}/tarball/${t.ref}`}},"github"),zt=w((r,e)=>{const t=N(r,{expandRepo:!0}),n=process.env.GIGET_GITLAB_URL||"https://gitlab.com";return{name:t.repo.replace("/","-"),version:t.ref,subdir:t.subdir,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0,"sec-fetch-mode":"same-origin"},url:`${n}/${t.repo}/tree/${t.ref}${t.subdir}`,tar:`${n}/${t.repo}/-/archive/${t.ref}.tar.gz`}},"gitlab"),It=w((r,e)=>{const t=N(r);return{name:t.repo.replace("/","-"),version:t.ref,subdir:t.subdir,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0},url:`https://bitbucket.com/${t.repo}/src/${t.ref}${t.subdir}`,tar:`https://bitbucket.org/${t.repo}/get/${t.ref}.tar.gz`}},"bitbucket"),Dt=w((r,e)=>{const t=N(r);return{name:t.repo.replace("/","-"),version:t.ref,subdir:t.subdir,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0},url:`https://git.sr.ht/~${t.repo}/tree/${t.ref}/item${t.subdir}`,tar:`https://git.sr.ht/~${t.repo}/archive/${t.ref}.tar.gz`}},"sourcehut"),Ft={http:re,https:re,git:Pt,github:oe,gh:oe,gitlab:zt,bitbucket:It,sourcehut:Dt},Nt="https://raw.githubusercontent.com/unjs/giget/main/templates",Mt=w((r=Nt,e={})=>(async t=>{const n=Date.now(),o=`${r}/${t}.json`,i=await I(o,{headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0}});if(i.status>=400)throw new Error(`Failed to download ${t} template info from ${o}: ${i.status} ${i.statusText}`);const c=await i.json();if(!c.tar||!c.name)throw new Error(`Invalid template info from ${o}. name or tar fields are missing!`);return C(`Fetched ${t} template info from ${o} in ${Date.now()-n}ms`),c}),"registryProvider"),Gt=/^([\w+-.]+):/;async function Ht(r,e={}){e.registry=process.env.GIGET_REGISTRY??e.registry,e.auth=process.env.GIGET_AUTH??e.auth;const t=e.registry===!1?void 0:Mt(e.registry,{auth:e.auth});let n=e.provider||(t?"registry":"github"),o=r;const i=r.match(Gt);i&&(n=i[1],o=r.slice(i[0].length),(n==="http"||n==="https")&&(o=r)),n.endsWith("+git")&&(o=`${n.slice(0,-4)}:${o}`,n="git");const c=e.providers?.[n]||Ft[n]||t;if(!c)throw new Error(`Unsupported provider: ${n}`);const s=await Promise.resolve().then(()=>c(o,{auth:e.auth})).catch(m=>{throw new Error(`Failed to download template from ${n}: ${m.message}`)});if(!s)throw new Error(`Failed to resolve template from ${n}`);s.name=(s.name||"template").replace(/[^\da-z-]/gi,"-"),s.defaultDir=(s.defaultDir||s.name).replace(/[^\da-z-]/gi,"-");const a=$($(Oe(),n,s.name),(s.version||s.name)+".tar.gz");if(e.preferOffline&&x(a)&&(e.offline=!0),!e.offline){await H(fe(a),{recursive:!0});const m=Date.now();if(typeof s.tar=="function"){const g=s.tar;await(async()=>{const v=await g({auth:e.auth});await Ze(v instanceof q?v:q.fromWeb(v),se(a))})().catch(v=>{if(!x(a))throw v;C("Download error. Using cached version:",v),e.offline=!0})}else await Ce(s.tar,a,{headers:{Authorization:e.auth?`Bearer ${e.auth}`:void 0,...X(s.headers)}}).catch(g=>{if(!x(a))throw g;C("Download error. Using cached version:",g),e.offline=!0});C(`Downloaded to ${a} in ${Date.now()-m}ms`)}if(!x(a))throw new Error(`Tarball not found: ${a} (offline: ${e.offline})`);const l=$($(e.cwd||"."),e.dir||s.defaultDir);if(e.forceClean&&await M(l,{recursive:!0,force:!0}),!e.force&&x(l)&&Ge(l).length>0)throw new Error(`Destination ${l} already exists.`);await H(l,{recursive:!0});const u=Date.now(),h=s.subdir?.replace(/^\//,"")||"",{extract:d}=await import("../packem_chunks/tar.js").then(m=>m.t);if(await d({file:a,cwd:l,onReadEntry(m){m.path=m.path.split("/").splice(1).join("/"),h&&(m.path.startsWith(h+"/")?m.path=m.path.slice(h.length):m.path="")}}),C(`Extracted to ${l} in ${Date.now()-u}ms`),e.install){C("Installing dependencies...");const{installDependencies:m}=await Promise.resolve().then(()=>Ct).then(g=>g.t);await m({cwd:l,silent:e.silent,...typeof e.install=="object"?e.install:{}})}return{...s,source:o,dir:l}}f(Ht,"fe");w(Ht,"downloadTemplate");export{Ht as f,tt as p};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var B=Object.defineProperty;var c=(e,t)=>B(e,"name",{value:t,configurable:!0});import{createRequire as G}from"node:module";import{f as C,g as k,M as w}from"../packem_chunks/config.js";import{aK as Q,$ as U,aL as j}from"../packem_chunks/bin.js";const q=G(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,m=c(e=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[t,r]=l.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return l.getBuiltinModule(e)}return q(e)},"__cjs_getBuiltinModule"),{Socket:V}=m("node:net"),{randomBytes:H}=m("node:crypto"),{readdir:K,writeFile:W,rename:X,rm:S,open:P,readFile:J,stat:Y,unlink:R}=m("node:fs/promises"),{createRequire:z}=m("node:module"),{spawn:Z}=m("node:child_process");var ee=Object.defineProperty,te=c((e,t)=>ee(e,"name",{value:t,configurable:!0}),"i$1"),re=Object.defineProperty,O=te((e,t)=>re(e,"name",{value:t,configurable:!0}),"s");const oe=z(import.meta.url),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ie=O(e=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[t,r]=f.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return f.getBuiltinModule(e)}return oe(e)},"__cjs_getBuiltinModule"),{lstat:D,mkdir:ae}=ie("node:fs/promises");var se=Object.defineProperty,ne=O((e,t)=>se(e,"name",{value:t,configurable:!0}),"o");const ce=ne(async e=>{C(e);try{const t=await D(e);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(k(t))}'`);return}catch(t){if(t.code!=="ENOENT")throw t}try{await ae(e,{recursive:!0})}catch(t){if(t.code!=="EEXIST")throw t;const r=await D(e);if(!r.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(k(r))}'`,{cause:t})}},"ensureDir");var de=Object.defineProperty,d=c((e,t)=>de(e,"name",{value:t,configurable:!0}),"s");const ue=3e4,F=100;class we extends Error{static{c(this,"ServiceReadinessError")}constructor(t,r){super(t),this.elapsedMs=r,this.name="ServiceReadinessError"}elapsedMs;static{d(this,"ServiceReadinessError")}}const pe=d(async e=>{const t=e.host??"127.0.0.1",{port:r}=e,o=e.timeoutMs??ue,i=Date.now();for(;Date.now()-i<o;){if(await le(t,r))return;await fe(F)}throw new we(`Timed out waiting for ${t}:${String(r)} to accept TCP connections (${String(o)}ms)`,Date.now()-i)},"waitForTcp"),le=d((e,t)=>new Promise(r=>{const o=new V,i=d(a=>{o.removeAllListeners(),o.destroy(),r(a)},"onDone");o.once("connect",()=>{i(!0)}),o.once("error",()=>{i(!1)}),o.setTimeout(F,()=>{i(!1)});try{o.connect(t,e)}catch{i(!1)}}),"tryConnect"),fe=d(e=>new Promise(t=>{setTimeout(t,e)}),"delay"),ye=d(async(e,t)=>{const r=e.readiness??(e.port===void 0?void 0:{tcp:{port:e.port}});r&&await pe({host:r.tcp.host,port:r.tcp.port,timeoutMs:t?.timeoutMs??r.tcp.timeoutMs})},"runReadiness");var me=Object.defineProperty,s=c((e,t)=>me(e,"name",{value:t,configurable:!0}),"o");const $=384,T=5e3,he=50,ve=3e4,p=s(async e=>{const t=w(Q(e),"services");try{await ce(t)}catch(r){throw r.code==="ENOTDIR"?new Error(`Service registry path ${t} exists but is not a directory. Remove it or move the conflicting file before running \`vis service\`.`,{cause:r}):r}return t},"getRegistryDir"),E=s(e=>e.replaceAll("/","_").replaceAll(":","__"),"slugify"),b=s((e,t)=>w(e,`${E(t)}.json`),"entryPath"),ge=s((e,t)=>w(e,`${E(t)}.lock`),"lockPath"),h=s(async(e,t)=>{const r=await p(e),o=b(r,t);if(await U(o))try{return await j(o)}catch{return}},"readEntry"),Se=s(async e=>{const t=await p(e);let r;try{r=await K(t)}catch{return[]}const o=[];for(const i of r)if(i.endsWith(".json"))try{const a=await j(w(t,i));o.push(a)}catch{}return o},"readAllEntries"),$e=s(async(e,t)=>{const r=await p(e),o=b(r,t.id),i=w(r,`.${H(8).toString("hex")}.tmp`);await W(i,`${JSON.stringify(t,void 0,2)}
|
|
2
|
+
`,{mode:$});try{await X(i,o)}catch(a){throw await S(i,{force:!0}).catch(()=>{}),a}},"writeEntry"),y=s(async(e,t,r)=>{const o=await p(e),i=r??await h(e,t);await S(b(o,t),{force:!0}),i&&await S(i.logFile,{force:!0}).catch(()=>{})},"deleteEntry"),u=s(e=>{try{return process.kill(e,0),!0}catch{return!1}},"isAlive"),Fe=s(async e=>{const t=await Se(e),r=[],o=[];for(const i of t){if(u(i.pid)){o.push(i);continue}const a=await h(e,i.id);if(a&&a.pid!==i.pid){o.push(a);continue}await y(e,i.id,i).catch(()=>{}),r.push(i.id)}return{pruned:r,surviving:o}},"pruneDead"),Ee=s(e=>new Promise(t=>{setTimeout(t,e)}),"sleep"),be=s(async e=>{try{const t=await P(e,"wx",$);try{await t.writeFile(String(process.pid))}finally{await t.close().catch(()=>{})}return!0}catch(t){if(t.code==="EEXIST")return!1;throw t}},"tryClaimLock"),ke=s(async e=>{let t;try{const r=await J(e,"utf8"),o=Number.parseInt(r.trim(),10);t=Number.isFinite(o)?o:void 0}catch{return!0}if(t!==void 0&&!u(t))return!0;try{const r=await Y(e);return Date.now()-r.mtimeMs>ve}catch{return!0}},"isLockStale"),I=s(async(e,t,r)=>{const o=await p(e),i=ge(o,t),a=Date.now();for(;!await be(i);){if(await ke(i)){await R(i).catch(()=>{});continue}if(Date.now()-a>=T)throw new Error(`Could not acquire service lock for ${t} within ${String(T)}ms — another \`vis service\` invocation appears to be holding it.`);await Ee(he)}try{return await r()}finally{await R(i).catch(()=>{})}},"withServiceLock");var Re=Object.defineProperty,De=c((e,t)=>Re(e,"name",{value:t,configurable:!0}),"i");const _=process.platform==="win32",Te=De(async e=>{const{command:t,cwd:r,env:o,logFile:i}=e,a=await P(i,"a",$);let n;try{n=Z(_?"cmd":"/bin/sh",_?["/d","/s","/c",t]:["-c",t],{cwd:r,detached:!0,env:{...process.env,...o},stdio:["ignore",a.fd,a.fd],windowsHide:!0})}finally{await a.close().catch(()=>{})}if(n.pid===void 0&&await new Promise((g,N)=>{n.once("spawn",()=>{g()}),n.once("error",A=>{N(A)})}),n.pid===void 0)throw new Error(`Failed to spawn detached process for command: ${t}`);return n.unref(),{pid:n.pid}},"spawnDetached");var _e=Object.defineProperty,v=c((e,t)=>_e(e,"name",{value:t,configurable:!0}),"t");const L=5e3,Ie=v(async e=>I(e.workspaceRoot,e.id,async()=>{const t=await h(e.workspaceRoot,e.id);if(t&&u(t.pid))throw new Error(`Service ${e.id} is already running (pid ${String(t.pid)})`);t&&await y(e.workspaceRoot,e.id,t);const r=await p(e.workspaceRoot),o=E(e.id),i=w(r,`${o}.log`),{pid:a}=await Te({command:e.command,cwd:e.cwd,env:e.env,logFile:i}),n={command:e.command,config:e.config,cwd:e.cwd,env:e.config.env??{},id:e.id,logFile:i,pid:a,slug:o,startedAt:new Date().toISOString(),visVersion:process.env.VIS_VERSION??"0.0.0"};if(await $e(e.workspaceRoot,n),e.skipReadiness!==!0)try{await ye(e.config,{timeoutMs:e.readinessTimeoutMs})}catch(g){throw await x(a,e.config.killGracePeriodMs??L).catch(()=>{}),await y(e.workspaceRoot,e.id,n).catch(()=>{}),g}return{entry:n}}),"startService"),Le=v(async e=>I(e.workspaceRoot,e.id,async()=>{const t=await h(e.workspaceRoot,e.id);if(!t)return{stopped:!1};if(!u(t.pid))return await y(e.workspaceRoot,e.id,t),{stopped:!1};const r=e.graceMs??t.config.killGracePeriodMs??L;return await x(t.pid,r),await y(e.workspaceRoot,e.id,t),{stopped:!0}}),"stopService"),x=v(async(e,t)=>{M(e,"SIGTERM");const r=Date.now();for(;Date.now()-r<t;){if(!u(e))return;await new Promise(o=>{setTimeout(o,100)})}u(e)&&M(e,"SIGKILL")},"stopServiceByPid"),M=v((e,t)=>{try{process.platform==="win32"?process.kill(e,t):process.kill(-e,t)}catch(r){if(r.code==="ESRCH")return;throw r}},"sendSignalToServiceGroup");export{we as S,Le as a,h as b,ye as c,y as d,u as i,Fe as p,Se as r,Ie as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var T=Object.defineProperty;var j=(n,e)=>T(n,"name",{value:e,configurable:!0});import{createRequire as A}from"node:module";import{r as R,t as C}from"../packem_chunks/bin.js";const B=A(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,q=j(n=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[e,t]=h.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return h.getBuiltinModule(n)}return B(n)},"__cjs_getBuiltinModule"),{createRequire:N}=q("node:module");var U=Object.defineProperty,z=j((n,e)=>U(n,"name",{value:e,configurable:!0}),"L"),I=Object.defineProperty,F=z((n,e)=>I(n,"name",{value:e,configurable:!0}),"F");const J=N(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,S=F(n=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[e,t]=y.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return y.getBuiltinModule(n)}return J(n)},"__cjs_getBuiltinModule"),{readFileSync:Y}=S("node:fs"),{readFile:Z}=S("node:fs/promises");var K=Object.defineProperty,l=F((n,e)=>K(n,"name",{value:e,configurable:!0}),"g");const G={sha256:"sha256",sha384:"sha384",sha512:"sha512"},H=1024,Q=/^[A-Z0-9+/]+={0,2}$/i,V=/.*node_modules\/((?:@[^/]+\/)?[^/]+)$/,k=/^['"]/,v=/['"]$/,X=/^[a-z][a-zA-Z0-9]*:\s*$/m,ee=/resolution:\s*\{[^}]*integrity:\s*([^,}\s]+)/,ne=/^["']?((?:@[^/@"']+\/)?[^@"'\n]+)@[^"'\n]+["']?:?[\t\v\f\r \u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*\n((?:[\t ][^\n]*\n?)+)/gm,te=/^\s+version:?\s+"?([^"\n]+)"?/m,se=/^\s+integrity[\s:]+"?([^"\s]+)"?/m,x=l(n=>{if(n.length>H)return;const e=n.indexOf("-");if(e<=0)return;const t=G[n.slice(0,e).toLowerCase()];if(!t)return;const s=n.slice(e+1);if(Q.test(s))try{const i=Buffer.from(s,"base64");return i.length===0?void 0:{algorithm:t,hex:i.toString("hex")}}catch{return}},"decodeSriIntegrity"),w=l((n,e,t)=>{const s=`${t.name}@${t.version}`;e.has(s)||(e.add(s),n.push(t))},"pushUniqueEntry"),m=l((n,e,t)=>{t&&Object.keys(t).length>0&&(n[e]={...t})},"copyDepMap"),g=l(n=>{if(!n)return;const e={};for(const[t,s]of Object.entries(n))e[t]=[s];return Object.keys(e).length>0?e:void 0},"liftDepMap"),re=l(n=>{const e=[],t=new Set;let s;try{s=JSON.parse(n)}catch{return e}if(!s.packages)return e;for(const[i,r]of Object.entries(s.packages)){if(!i||!r.version)continue;const p=V.exec(i);if(!p?.[1])continue;const c=r.name??p[1];if(c.startsWith("."))continue;const o={name:c,version:r.version};if(r.integrity){const a=x(r.integrity);a&&(o.integrity=a)}m(o,"dependencies",g(r.dependencies)),m(o,"peerDependencies",g(r.peerDependencies)),m(o,"optionalDependencies",g(r.optionalDependencies)),w(e,t,o)}return e},"parseNpmLockFile"),_=l(n=>{let e=n.trim();e.startsWith("/")&&(e=e.slice(1)),e=e.replace(k,"").replace(v,"");const t=e.indexOf("(");t>0&&(e=e.slice(0,t));const s=e.lastIndexOf("@");if(s<=0)return;const i=e.slice(0,s),r=e.slice(s+1);if(!(!i||!r||r.startsWith("link:")||r.startsWith("workspace:")||r.startsWith("file:")))return{name:i,version:r}},"splitPnpmPackageKey"),W=l((n,e)=>{const t=new RegExp(String.raw`^${e}:\s*$`,"m").exec(n);if(!t)return;const s=t.index+t[0].length,i=X.exec(n.slice(s));return n.slice(s,i?s+i.index:n.length)},"sliceTopLevelSection"),oe=l(n=>{const e=new Map,t=W(n,"snapshots");if(!t)return e;const s=/^ {2}(['"]?[^\s:][^:\n]*?['"]?):\s*\n((?: {4}[^\n]*\n?)+)/gm;let i;for(;(i=s.exec(t)??void 0)!==void 0;){const r=_(i[1]);if(!r)continue;const p=`${r.name}@${r.version}`,c=i[2],o=e.get(p)??{};for(const a of["dependencies","peerDependencies","optionalDependencies"]){const u=b(c,a);if(!u)continue;const d=o[a]??{};for(const[f,P]of Object.entries(u)){const D=d[f]??[];for(const $ of P)D.includes($)||D.push($);d[f]=D}o[a]=d}e.set(p,o)}return e},"parsePnpmSnapshotEdges"),ie=l(n=>{const e=[],t=new Set,s=W(n,"packages");if(!s)return e;const i=oe(n),r=/^ {2}(['"]?[^\s:][^:\n]*?['"]?):\s*\n((?: {4}[^\n]*\n?)+)/gm;let p;for(;(p=r.exec(s)??void 0)!==void 0;){const c=_(p[1]);if(!c)continue;const o=p[2],a=ee.exec(o),u={name:c.name,version:c.version};if(a?.[1]){const f=x(a[1]);f&&(u.integrity=f)}const d=i.get(`${c.name}@${c.version}`);m(u,"dependencies",d?.dependencies??b(o,"dependencies")),m(u,"peerDependencies",d?.peerDependencies??b(o,"peerDependencies")),m(u,"optionalDependencies",d?.optionalDependencies??b(o,"optionalDependencies")),w(e,t,u)}return e},"parsePnpmLockFile"),b=l((n,e)=>{const t=new RegExp(String.raw`^ {4}${e}:\s*\n((?: {6,}[^\n]*\n?)+)`,"m").exec(n);if(!t?.[1])return;const s={},i=/^ {6}([^\s:]+):\s*([^\n]+)/gm;let r;for(;(r=i.exec(t[1])??void 0)!==void 0;){const p=r[1].replace(k,"").replace(v,"");let c=r[2].trim();c=c.replace(k,"").replace(v,"");const o=c.indexOf("(");if(o>0&&(c=c.slice(0,o).trim()),!p||!c)continue;const a=s[p]??[];a.includes(c)||a.push(c),s[p]=a}return Object.keys(s).length>0?s:void 0},"extractPnpmDependencyMap"),ce=l(n=>{const e=[],t=new Set,s=ne;s.lastIndex=0;let i;for(;(i=s.exec(n)??void 0)!==void 0;){const r=i[1].replace(k,"").replace(v,"");if(!r)continue;const p=i[2],c=te.exec(p);if(!c?.[1])continue;const o={name:r,version:c[1].trim()},a=se.exec(p);if(a?.[1]){const u=x(a[1]);u&&(o.integrity=u)}m(o,"dependencies",O(p,"dependencies")),m(o,"peerDependencies",O(p,"peerDependencies")),m(o,"optionalDependencies",O(p,"optionalDependencies")),w(e,t,o)}return e},"parseYarnLockFile"),O=l((n,e)=>{const t=new RegExp(String.raw`^ {2}${e}:\s*\n((?: {4,}[^\n]*\n?)+)`,"m").exec(n);if(!t?.[1])return;const s={},i=/^ {4}(['"]?[^\s:'"]+['"]?)\s*(?::\s*)?['"]([^'"\n]+)['"]/gm;let r;for(;(r=i.exec(t[1])??void 0)!==void 0;){const p=r[1].replace(k,"").replace(v,""),c=r[2];if(p&&c){const o=s[p]??[];o.includes(c)||o.push(c),s[p]=o}}return Object.keys(s).length>0?s:void 0},"extractYarnDependencyMap"),pe=/,(?=\s*[}\]])/g,ae=l(n=>{const e=[],t=new Set;let s;try{s=JSON.parse(n.replaceAll(pe,""))}catch{return e}if(!s.packages)return e;for(const i of Object.values(s.packages)){const r=i[0];if(typeof r!="string")continue;const p=r.indexOf("@",1);if(p<=0)continue;const c=r.slice(0,p),o=r.slice(p+1);if(!c||!o||o.startsWith("workspace:")||o.startsWith("link:")||o.startsWith("file:"))continue;const a={name:c,version:o},u=i[3];if(typeof u=="string"&&u.length>0){const f=x(u);f&&(a.integrity=f)}const d=i[2];if(d&&typeof d=="object"&&!Array.isArray(d)){const f=d;m(a,"dependencies",g(f.dependencies)),m(a,"peerDependencies",g(f.peerDependencies)),m(a,"optionalDependencies",g(f.optionalDependencies))}w(e,t,a)}return e},"parseBunLockFile"),E=l(n=>{if(n.endsWith("pnpm-lock.yaml"))return"pnpm";if(n.endsWith("package-lock.json"))return"npm";if(n.endsWith("yarn.lock"))return"yarn";if(n.endsWith("bun.lock"))return"bun"},"inferLockFileType"),L=l((n,e)=>{switch(e){case"bun":return ae(n);case"npm":return re(n);case"pnpm":return ie(n);case"yarn":return ce(n);default:return[]}},"parseLockFileContent"),M=["pnpm-lock.yaml","package-lock.json","yarn.lock","bun.lock"];l(async n=>{const e=await R(M,{type:"file",...n&&{cwd:n}});if(!e)throw new Error("Could not find a supported lock file (pnpm-lock.yaml, package-lock.json, yarn.lock, bun.lock)");const t=E(e);if(!t)throw new Error(`Unsupported lock file: ${e}`);const s=await Z(e,"utf8");return{entries:L(s,t),path:e,type:t}},"parseLockFile");l(n=>{const e=C(M,{type:"file",...n&&{cwd:n}});if(!e)throw new Error("Could not find a supported lock file (pnpm-lock.yaml, package-lock.json, yarn.lock, bun.lock)");const t=E(e);if(!t)throw new Error(`Unsupported lock file: ${e}`);return{entries:L(Y(e,"utf8"),t),path:e,type:t}},"parseLockFileSync");export{L as F};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var l=Object.defineProperty;var c=(a,n)=>l(a,"name",{value:n,configurable:!0});import{definePlugin as f}from"./definePlugin-CWm4Dv_t.js";var o;(function(a){a[a.UNSET=0]="UNSET",a[a.OK=1]="OK",a[a.ERROR=2]="ERROR"})(o||(o={}));var k=Object.defineProperty,u=c((a,n)=>k(a,"name",{value:n,configurable:!0}),"i");const p=u(a=>{const{renameSpan:n,tracer:d}=a;let r;const i=new Map;return f({hooks:{"run:after":u(e=>{if(!r)return;const t=[...e.values()].filter(s=>s.status==="failure").length;r.setAttribute("vis.run.tasks_total",e.size),r.setAttribute("vis.run.tasks_failed",t),t>0?r.setStatus({code:o.ERROR,message:`${String(t)} task(s) failed`}):r.setStatus({code:o.OK}),r.end(),r=void 0;for(const s of i.values())s.end();i.clear()},"run:after"),"run:before":u(e=>{r&&(r.setStatus({code:o.ERROR,message:"run:before fired while previous run was still active"}),r.end());for(const t of i.values())t.end();i.clear(),r=d.startSpan("vis.run",{attributes:{"vis.run.task_count":e.tasks.length,"vis.workspace_root":e.workspaceRoot}})},"run:before"),"task:after":u((e,t)=>{const s=i.get(e.id);s&&(s.setAttribute("vis.task.exit_code",t.code??0),s.setAttribute("vis.task.cache_status",t.status),s.end(),i.delete(e.id))},"task:after"),"task:before":u(e=>{const t=i.get(e.id);t&&(t.setStatus({code:o.ERROR,message:"retried — superseded by new attempt"}),t.end());const s=d.startSpan(n?n(e):e.id,{attributes:{"vis.task.id":e.id,"vis.task.project":e.target.project,"vis.task.target":e.target.target}});i.set(e.id,s)},"task:before"),"task:failure":u((e,t)=>{const s=i.get(e.id);s&&s.setStatus({code:o.ERROR,message:`Task failed with exit code ${String(t.code??-1)}`})},"task:failure")},name:"otel"})},"otelPlugin");export{p as otelPlugin};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
var X=Object.defineProperty;var s=(e,t)=>X(e,"name",{value:t,configurable:!0});import{$ as Y}from"../packem_chunks/config.js";var ee=Object.defineProperty,A=s((e,t)=>ee(e,"name",{value:t,configurable:!0}),"i");/*!
|
|
2
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions are met:
|
|
7
|
+
*
|
|
8
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
* list of conditions and the following disclaimer.
|
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
* this list of conditions and the following disclaimer in the
|
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
|
13
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
14
|
+
* may be used to endorse or promote products derived from this software without
|
|
15
|
+
* specific prior written permission.
|
|
16
|
+
*
|
|
17
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
18
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
19
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
21
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
23
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
24
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
25
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
*/function C(e,t){let r=e.slice(0,t).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}s(C,"d$2");A(C,"getLineColFromPtr");function D(e,t,r){let n=e.split(/\r\n|\n|\r/g),o="",l=(Math.log10(t+1)|0)+1;for(let i=t-1;i<=t+1;i++){let a=n[i-1];a&&(o+=i.toString().padEnd(l," "),o+=": ",o+=a,o+=`
|
|
28
|
+
`,i===t&&(o+=" ".repeat(l+r+2),o+=`^
|
|
29
|
+
`))}return o}s(D,"m$3");A(D,"makeCodeBlock");class c extends Error{static{s(this,"TomlError")}static{A(this,"TomlError")}line;column;codeblock;constructor(t,r){const[n,o]=C(r.toml,r.ptr),l=D(r.toml,n,o);super(`Invalid TOML document: ${t}
|
|
30
|
+
|
|
31
|
+
${l}`,r),this.line=n,this.column=o,this.codeblock=l}}var te=Object.defineProperty,g=s((e,t)=>te(e,"name",{value:t,configurable:!0}),"e");function V(e,t){let r=0;for(;e[t-++r]==="\\";);return--r&&r%2}s(V,"h$4");g(V,"isEscaped");function x(e,t=0,r=e.length){let n=e.indexOf(`
|
|
32
|
+
`,t);return e[n-1]==="\r"&&n--,n<=r?n:-1}s(x,"indexOfNewline");g(x,"indexOfNewline");function v(e,t){for(let r=t;r<e.length;r++){let n=e[r];if(n===`
|
|
33
|
+
`)return r;if(n==="\r"&&e[r+1]===`
|
|
34
|
+
`)return r+1;if(n<" "&&n!==" "||n==="")throw new c("control characters are not allowed in comments",{toml:e,ptr:t})}return e.length}s(v,"skipComment");g(v,"skipComment");function h(e,t,r,n){let o;for(;;){for(;(o=e[t])===" "||o===" "||!r&&(o===`
|
|
35
|
+
`||o==="\r"&&e[t+1]===`
|
|
36
|
+
`);)t++;if(n||o!=="#")break;t=v(e,t)}return t}s(h,"skipVoid");g(h,"skipVoid");function z(e,t,r,n,o=!1){if(!n)return t=x(e,t),t<0?e.length:t;for(let l=t;l<e.length;l++){let i=e[l];if(i==="#")l=x(e,l);else{if(i===r)return l+1;if(i===n||o&&(i===`
|
|
37
|
+
`||i==="\r"&&e[l+1]===`
|
|
38
|
+
`))return l}}throw new c("cannot find end of structure",{toml:e,ptr:t})}s(z,"skipUntil");g(z,"skipUntil");function P(e,t){let r=e[t],n=r===e[t+1]&&e[t+1]===e[t+2]?e.slice(t,t+3):r;t+=n.length-1;do t=e.indexOf(n,++t);while(t>-1&&r!=="'"&&V(e,t));return t>-1&&(t+=n.length,n.length>1&&(e[t]===r&&t++,e[t]===r&&t++)),t}s(P,"getStringEnd");g(P,"getStringEnd");var re=Object.defineProperty,ne=s((e,t)=>re(e,"name",{value:t,configurable:!0}),"l$1");/*!
|
|
39
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
40
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
41
|
+
*
|
|
42
|
+
* Redistribution and use in source and binary forms, with or without
|
|
43
|
+
* modification, are permitted provided that the following conditions are met:
|
|
44
|
+
*
|
|
45
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
46
|
+
* list of conditions and the following disclaimer.
|
|
47
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
48
|
+
* this list of conditions and the following disclaimer in the
|
|
49
|
+
* documentation and/or other materials provided with the distribution.
|
|
50
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
51
|
+
* may be used to endorse or promote products derived from this software without
|
|
52
|
+
* specific prior written permission.
|
|
53
|
+
*
|
|
54
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
55
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
56
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
57
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
58
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
59
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
60
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
61
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
62
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
63
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
64
|
+
*/let ie=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;class w extends Date{static{s(this,"TomlDate")}static{ne(this,"TomlDate")}#t=!1;#r=!1;#e=null;constructor(t){let r=!0,n=!0,o="Z";if(typeof t=="string"){let l=t.match(ie);l?(l[1]||(r=!1,t=`0000-01-01T${t}`),n=!!l[2],n&&t[10]===" "&&(t=t.replace(" ","T")),l[2]&&+l[2]>23?t="":(o=l[3]||null,t=t.toUpperCase(),!o&&n&&(t+="Z"))):t=""}super(t),isNaN(this.getTime())||(this.#t=r,this.#r=n,this.#e=o)}isDateTime(){return this.#t&&this.#r}isLocal(){return!this.#t||!this.#r||!this.#e}isDate(){return this.#t&&!this.#r}isTime(){return this.#r&&!this.#t}isValid(){return this.#t||this.#r}toISOString(){let t=super.toISOString();if(this.isDate())return t.slice(0,10);if(this.isTime())return t.slice(11,23);if(this.#e===null)return t.slice(0,-1);if(this.#e==="Z")return t;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(t,r="Z"){let n=new w(t);return n.#e=r,n}static wrapAsLocalDateTime(t){let r=new w(t);return r.#e=null,r}static wrapAsLocalDate(t){let r=new w(t);return r.#r=!1,r.#e=null,r}static wrapAsLocalTime(t){let r=new w(t);return r.#t=!1,r.#e=null,r}}var le=Object.defineProperty,L=s((e,t)=>le(e,"name",{value:t,configurable:!0}),"w$1");let oe=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,ae=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,fe=/^[+-]?0[0-9_]/,ue=/^[0-9a-f]{2,8}$/i,I={b:"\b",t:" ",n:`
|
|
65
|
+
`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function N(e,t=0,r=e.length){let n=e[t]==="'",o=e[t++]===e[t]&&e[t]===e[t+1];o&&(r-=2,e[t+=2]==="\r"&&t++,e[t]===`
|
|
66
|
+
`&&t++);let l=0,i,a="",u=t;for(;t<r-1;){let f=e[t++];if(f===`
|
|
67
|
+
`||f==="\r"&&e[t]===`
|
|
68
|
+
`){if(!o)throw new c("newlines are not allowed in strings",{toml:e,ptr:t-1})}else if(f<" "&&f!==" "||f==="")throw new c("control characters are not allowed in strings",{toml:e,ptr:t-1});if(i){if(i=!1,f==="x"||f==="u"||f==="U"){let d=e.slice(t,t+=f==="x"?2:f==="u"?4:8);if(!ue.test(d))throw new c("invalid unicode escape",{toml:e,ptr:l});try{a+=String.fromCodePoint(parseInt(d,16))}catch{throw new c("invalid unicode escape",{toml:e,ptr:l})}}else if(o&&(f===`
|
|
69
|
+
`||f===" "||f===" "||f==="\r")){if(t=h(e,t-1,!0),e[t]!==`
|
|
70
|
+
`&&e[t]!=="\r")throw new c("invalid escape: only line-ending whitespace may be escaped",{toml:e,ptr:l});t=h(e,t)}else if(f in I)a+=I[f];else throw new c("unrecognized escape sequence",{toml:e,ptr:l});u=t}else!n&&f==="\\"&&(l=t-1,i=!0,a+=e.slice(u,l))}return a+e.slice(u,r-1)}s(N,"parseString");L(N,"parseString");function Z(e,t,r,n){if(e==="true")return!0;if(e==="false")return!1;if(e==="-inf")return-1/0;if(e==="inf"||e==="+inf")return 1/0;if(e==="nan"||e==="+nan"||e==="-nan")return NaN;if(e==="-0")return n?0n:0;let o=oe.test(e);if(o||ae.test(e)){if(fe.test(e))throw new c("leading zeroes are not allowed",{toml:t,ptr:r});e=e.replace(/_/g,"");let i=+e;if(isNaN(i))throw new c("invalid number",{toml:t,ptr:r});if(o){if((o=!Number.isSafeInteger(i))&&!n)throw new c("integer value cannot be represented losslessly",{toml:t,ptr:r});(o||n===!0)&&(i=BigInt(e))}return i}const l=new w(e);if(!l.isValid())throw new c("invalid value",{toml:t,ptr:r});return l}s(Z,"parseValue");L(Z,"parseValue");var se=Object.defineProperty,F=s((e,t)=>se(e,"name",{value:t,configurable:!0}),"t$1");function B(e,t,r){let n=e.slice(t,r),o=n.indexOf("#");return o>-1&&(v(e,o),n=n.slice(0,o)),[n.trimEnd(),o]}s(B,"T$1");F(B,"sliceAndTrimEndOf");function j(e,t,r,n,o){if(n===0)throw new c("document contains excessively nested structures. aborting.",{toml:e,ptr:t});let l=e[t];if(l==="["||l==="{"){let[u,f]=l==="["?K(e,t,n,o):U(e,t,n,o);if(r){if(f=h(e,f),e[f]===",")f++;else if(e[f]!==r)throw new c("expected comma or end of structure",{toml:e,ptr:f})}return[u,f]}let i;if(l==='"'||l==="'"){i=P(e,t);let u=N(e,t,i);if(r){if(i=h(e,i),e[i]&&e[i]!==","&&e[i]!==r&&e[i]!==`
|
|
71
|
+
`&&e[i]!=="\r")throw new c("unexpected character encountered",{toml:e,ptr:i});i+=+(e[i]===",")}return[u,i]}i=z(e,t,",",r);let a=B(e,t,i-+(e[i-1]===","));if(!a[0])throw new c("incomplete key-value declaration: no value specified",{toml:e,ptr:t});return r&&a[1]>-1&&(i=h(e,t+a[1]),i+=+(e[i]===",")),[Z(a[0],e,t,o),i]}s(j,"extractValue");F(j,"extractValue");var ce=Object.defineProperty,_=s((e,t)=>ce(e,"name",{value:t,configurable:!0}),"m$2");let de=/^[a-zA-Z0-9-_]+[ \t]*$/;function O(e,t,r="="){let n=t-1,o=[],l=e.indexOf(r,t);if(l<0)throw new c("incomplete key-value: cannot find end of key",{toml:e,ptr:t});do{let i=e[t=++n];if(i!==" "&&i!==" ")if(i==='"'||i==="'"){if(i===e[t+1]&&i===e[t+2])throw new c("multiline strings are not allowed in keys",{toml:e,ptr:t});let a=P(e,t);if(a<0)throw new c("unfinished string encountered",{toml:e,ptr:t});n=e.indexOf(".",a);let u=e.slice(a,n<0||n>l?l:n),f=x(u);if(f>-1)throw new c("newlines are not allowed in keys",{toml:e,ptr:t+n+f});if(u.trimStart())throw new c("found extra tokens after the string part",{toml:e,ptr:a});if(l<a&&(l=e.indexOf(r,a),l<0))throw new c("incomplete key-value: cannot find end of key",{toml:e,ptr:t});o.push(N(e,t,a))}else{n=e.indexOf(".",t);let a=e.slice(t,n<0||n>l?l:n);if(!de.test(a))throw new c("only letter, numbers, dashes and underscores are allowed in keys",{toml:e,ptr:t});o.push(a.trimEnd())}}while(n+1&&n<l);return[o,h(e,l+1,!0,!0)]}s(O,"parseKey");_(O,"parseKey");function U(e,t,r,n){let o={},l=new Set,i;for(t++;(i=e[t++])!=="}"&&i;){if(i===",")throw new c("expected value, found comma",{toml:e,ptr:t-1});if(i==="#")t=v(e,t);else if(i!==" "&&i!==" "&&i!==`
|
|
72
|
+
`&&i!=="\r"){let a,u=o,f=!1,[d,m]=O(e,t-1);for(let $=0;$<d.length;$++){if($&&(u=f?u[a]:u[a]={}),a=d[$],(f=Object.hasOwn(u,a))&&(typeof u[a]!="object"||l.has(u[a])))throw new c("trying to redefine an already defined value",{toml:e,ptr:t});!f&&a==="__proto__"&&Object.defineProperty(u,a,{enumerable:!0,configurable:!0,writable:!0})}if(f)throw new c("trying to redefine an already defined value",{toml:e,ptr:t});let[y,W]=j(e,m,"}",r-1,n);l.add(y),u[a]=y,t=W}}if(!i)throw new c("unfinished table encountered",{toml:e,ptr:t});return[o,t]}s(U,"parseInlineTable");_(U,"parseInlineTable");function K(e,t,r,n){let o=[],l;for(t++;(l=e[t++])!=="]"&&l;){if(l===",")throw new c("expected value, found comma",{toml:e,ptr:t-1});if(l==="#")t=v(e,t);else if(l!==" "&&l!==" "&&l!==`
|
|
73
|
+
`&&l!=="\r"){let i=j(e,t-1,"]",r-1,n);o.push(i[0]),t=i[1]}}if(!l)throw new c("unfinished array encountered",{toml:e,ptr:t});return[o,t]}s(K,"parseArray");_(K,"parseArray");var he=Object.defineProperty,M=s((e,t)=>he(e,"name",{value:t,configurable:!0}),"b$1");function E(e,t,r,n){let o=t,l=r,i,a=!1,u;for(let f=0;f<e.length;f++){if(f){if(o=a?o[i]:o[i]={},l=(u=l[i]).c,n===0&&(u.t===1||u.t===2))return null;if(u.t===2){let d=o.length-1;o=o[d],l=l[d].c}}if(i=e[f],(a=Object.hasOwn(o,i))&&l[i]?.t===0&&l[i]?.d)return null;a||(i==="__proto__"&&(Object.defineProperty(o,i,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(l,i,{enumerable:!0,configurable:!0,writable:!0})),l[i]={t:f<e.length-1&&n===2?3:n,d:!1,i:0,c:{}})}if(u=l[i],u.t!==n&&!(n===1&&u.t===3)||(n===2&&(u.d||(u.d=!0,o[i]=[]),o[i].push(o={}),u.c[u.i++]=u={t:1,d:!1,i:0,c:{}}),u.d))return null;if(u.d=!0,n===1)o=a?o[i]:o[i]={};else if(n===0&&a)return null;return[i,o,u.c]}s(E,"w");M(E,"peekTable");function q(e,{maxDepth:t=1e3,integersAsBigInt:r}={}){let n={},o={},l=n,i=o;for(let a=h(e,0);a<e.length;){if(e[a]==="["){let u=e[++a]==="[",f=O(e,a+=+u,"]");if(u){if(e[f[1]-1]!=="]")throw new c("expected end of table declaration",{toml:e,ptr:f[1]-1});f[1]++}let d=E(f[0],n,o,u?2:1);if(!d)throw new c("trying to redefine an already defined table or value",{toml:e,ptr:a});i=d[2],l=d[1],a=f[1]}else{let u=O(e,a),f=E(u[0],l,i,0);if(!f)throw new c("trying to redefine an already defined table or value",{toml:e,ptr:a});let d=j(e,u[1],void 0,t,r);f[1][f[0]]=d[0],a=d[1]}if(a=h(e,a,!0),e[a]&&e[a]!==`
|
|
74
|
+
`&&e[a]!=="\r")throw new c("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:a});a=h(e,a)}return n}s(q,"parse");M(q,"parse");var pe=Object.defineProperty,p=s((e,t)=>pe(e,"name",{value:t,configurable:!0}),"l");/*!
|
|
75
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
76
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
77
|
+
*
|
|
78
|
+
* Redistribution and use in source and binary forms, with or without
|
|
79
|
+
* modification, are permitted provided that the following conditions are met:
|
|
80
|
+
*
|
|
81
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
82
|
+
* list of conditions and the following disclaimer.
|
|
83
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
84
|
+
* this list of conditions and the following disclaimer in the
|
|
85
|
+
* documentation and/or other materials provided with the distribution.
|
|
86
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
87
|
+
* may be used to endorse or promote products derived from this software without
|
|
88
|
+
* specific prior written permission.
|
|
89
|
+
*
|
|
90
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
91
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
92
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
93
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
94
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
95
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
96
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
97
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
98
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
99
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
100
|
+
*/let J=/^[a-z0-9-_]+$/i;function b(e){let t=typeof e;if(t==="object"){if(Array.isArray(e))return"array";if(e instanceof Date)return"date"}return t}s(b,"g");p(b,"extendedTypeOf");function G(e){for(let t=0;t<e.length;t++)if(b(e[t])!=="object")return!1;return e.length!=0}s(G,"E");p(G,"isArrayOfTables");function T(e){return JSON.stringify(e).replace(/\x7f/g,"\\u007f")}s(T,"a$1");p(T,"formatString");function k(e,t,r,n){if(r===0)throw new Error("Could not stringify the object: maximum object depth exceeded");if(t==="number")return isNaN(e)?"nan":e===1/0?"inf":e===-1/0?"-inf":n&&Number.isInteger(e)?e.toFixed(1):e.toString();if(t==="bigint"||t==="boolean")return e.toString();if(t==="string")return T(e);if(t==="date"){if(isNaN(e.getTime()))throw new TypeError("cannot serialize invalid date");return e.toISOString()}if(t==="object")return H(e,r,n);if(t==="array")return Q(e,r,n)}s(k,"d$1");p(k,"stringifyValue");function H(e,t,r){let n=Object.keys(e);if(n.length===0)return"{}";let o="{ ";for(let l=0;l<n.length;l++){let i=n[l];l&&(o+=", "),o+=J.test(i)?i:T(i),o+=" = ",o+=k(e[i],b(e[i]),t-1,r)}return o+" }"}s(H,"b");p(H,"stringifyInlineTable");function Q(e,t,r){if(e.length===0)return"[]";let n="[ ";for(let o=0;o<e.length;o++){if(o&&(n+=", "),e[o]===null||e[o]===void 0)throw new TypeError("arrays cannot contain null or undefined values");n+=k(e[o],b(e[o]),t-1,r)}return n+" ]"}s(Q,"x");p(Q,"stringifyArray");function R(e,t,r,n){if(r===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let o="";for(let l=0;l<e.length;l++)o+=`${o&&`
|
|
101
|
+
`}[[${t}]]
|
|
102
|
+
`,o+=S(0,e[l],t,r,n);return o}s(R,"k");p(R,"stringifyArrayTable");function S(e,t,r,n,o){if(n===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let l="",i="",a=Object.keys(t);for(let u=0;u<a.length;u++){let f=a[u];if(t[f]!==null&&t[f]!==void 0){let d=b(t[f]);if(d==="symbol"||d==="function")throw new TypeError(`cannot serialize values of type '${d}'`);let m=J.test(f)?f:T(f);if(d==="array"&&G(t[f]))i+=(i&&`
|
|
103
|
+
`)+R(t[f],r?`${r}.${m}`:m,n-1,o);else if(d==="object"){let y=r?`${r}.${m}`:m;i+=(i&&`
|
|
104
|
+
`)+S(y,t[f],y,n-1,o)}else l+=m,l+=" = ",l+=k(t[f],d,n,o),l+=`
|
|
105
|
+
`}}return e&&(l||!i)&&(l=l?`[${e}]
|
|
106
|
+
${l}`:`[${e}]`),l&&i?`${l}
|
|
107
|
+
${i}`:l||i}s(S,"h");p(S,"stringifyTable");function me(e,{maxDepth:t=1e3,numbersAsFloat:r=!1}={}){if(b(e)!=="object")throw new TypeError("stringify can only be called with an object");let n=S(0,e,"",t,r);return n[n.length-1]!==`
|
|
108
|
+
`?n+`
|
|
109
|
+
`:n}s(me,"stringify");p(me,"stringify");var we=Object.defineProperty,ge=s((e,t)=>we(e,"name",{value:t,configurable:!0}),"a"),be=Object.defineProperty,ye=ge((e,t)=>be(e,"name",{value:t,configurable:!0}),"t"),ve=Object.defineProperty,$e=ye((e,t)=>ve(e,"name",{value:t,configurable:!0}),"n");const je=$e((e,t)=>{const r=Y(e,{encoding:"utf8",...t});return q(r)},"readTomlSync");export{je as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var j=Object.defineProperty;var u=(e,s)=>j(e,"name",{value:s,configurable:!0});import{createRequire as M}from"node:module";import{M as f}from"../packem_chunks/config.js";import{n as p}from"../packem_chunks/bin.js";const _=M(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=u(e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[s,t]=m.versions.node.split(".").map(Number);if(s>22||s===22&&t>=3||s===20&&t>=16)return m.getBuiltinModule(e)}return _(e)},"__cjs_getBuiltinModule"),{readdir:l,stat:h,readFile:y}=g("node:fs/promises");var v=Object.defineProperty,c=u((e,s)=>v(e,"name",{value:s,configurable:!0}),"m");const w=c((e,s)=>e.tasks.find(t=>t.taskId===s),"findTaskInSummary"),d=c((e,s)=>{const t=e??{},n=s??{},i=[],r=[],o=[];for(const a of Object.keys(t))a in n?t[a]!==n[a]&&o.push(a):i.push(a);for(const a of Object.keys(n))a in t||r.push(a);return i.sort(),r.sort(),o.sort(),{added:i,changed:o,removed:r}},"diffHashBuckets"),B=c((e,s)=>({commandChanged:(e?.command??"")!==(s?.command??""),implicitDeps:d(e?.implicitDeps,s?.implicitDeps),nodes:d(e?.nodes,s?.nodes),runtime:d(e?.runtime,s?.runtime)}),"diffHashDetails"),D=c(async(e,s)=>{const t=f(p(e),`${s}.json`);try{const n=await y(t,"utf8");return JSON.parse(n)}catch{return}},"readRunSummaryById"),I=c(async(e,s)=>{const t=p(e);let n;try{n=await l(t)}catch{return}const i=[];for(const r of n){if(!r.endsWith(".json")||s!==void 0&&r===`${s}.json`)continue;const o=f(t,r);try{const a=await h(o);a.isFile()&&i.push({mtimeMs:a.mtimeMs,path:o})}catch{}}if(i.length!==0){i.sort((r,o)=>o.mtimeMs-r.mtimeMs);try{const r=await y(i[0].path,"utf8");return JSON.parse(r)}catch{return}}},"readPreviousRunSummary"),O=c(async e=>{const s=p(e);let t;try{t=await l(s)}catch{return[]}const n=[];for(const i of t){if(!i.endsWith(".json"))continue;const r=f(s,i);try{const o=await h(r);o.isFile()&&n.push({id:i.slice(0,-5),mtimeMs:o.mtimeMs,path:r})}catch{}}return n.sort((i,r)=>r.mtimeMs-i.mtimeMs),n},"listRunSummaries");export{I as a,B as d,w as f,O as l,D as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var d=Object.defineProperty;var f=(t,s)=>d(t,"name",{value:s,configurable:!0});import{M as m,a as h,$ as k,n as v}from"../packem_chunks/config.js";var $=Object.defineProperty,g=f((t,s)=>$(t,"name",{value:s,configurable:!0}),"p");const M=g(t=>{for(const s of[".nvmrc",".node-version"]){const i=m(t,s);if(h(i))try{return k(i).trim().replace(/^v/,"")}catch{}}},"readNodeVersionFile"),l=g((t,s)=>{const i=t.split(/[.\-+]/).map(r=>Number.parseInt(r,10)||0),c=s.split(/[.\-+]/).map(r=>Number.parseInt(r,10)||0),e=Math.max(i.length,c.length);for(let r=0;r<e;r++){const n=i[r]??0,a=c[r]??0;if(n!==a)return n-a}return 0},"compareVersions"),b=g((t,s)=>{const i=s.trim();if(i===""||i==="*")return!0;const c=i.split(/\s+/).filter(Boolean);for(const e of c)if(e.startsWith(">=")){if(l(t,e.slice(2).trim())<0)return!1}else if(e.startsWith("<=")){if(l(t,e.slice(2).trim())>0)return!1}else if(e.startsWith(">")){if(l(t,e.slice(1).trim())<=0)return!1}else if(e.startsWith("<")){if(l(t,e.slice(1).trim())>=0)return!1}else if(/^\d/.test(e)){const r=t.split("."),n=e.split(".");for(const[a,o]of n.entries())if(o!==r[a])return!1}return!0},"satisfiesRange"),x=g(t=>{const s=[],i=m(t,"package.json");let c;try{c=v(i)}catch{return s}const e=process.versions.node;if(c.engines?.node){const n=c.engines.node;b(e,n)||s.push({actual:e,expected:n,kind:"node",message:`package.json engines.node requires ${n}, but the current Node.js is ${e}.`,severity:"error"})}const r=M(t);if(r){const[n,a]=r.split("."),[o,p]=e.split(".");(n!==o||a!==void 0&&a!==p)&&s.push({actual:e,expected:r,kind:"node",message:`.nvmrc pins Node ${r} but the current Node.js is ${e}. Run \`nvm use\` or switch runtimes.`,severity:"warning"})}if(c.packageManager){const[n,a]=c.packageManager.split("@"),o=(process.env.npm_config_user_agent??"").split(" ")[0]??"",[p,u]=o.split("/");p&&n&&p!==n?s.push({actual:p,expected:n,kind:"packageManager",message:`package.json packageManager pins ${c.packageManager} but the current invocation is ${o}. Install the correct package manager.`,severity:"error"}):u&&a&&u!==a&&s.push({actual:u,expected:a,kind:"packageManager",message:`package.json packageManager pins ${n}@${a} but the current invocation uses ${n}@${u}.`,severity:"warning"})}return s},"checkRuntimeVersions");export{x as c};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var w=Object.defineProperty;var m=(e,t)=>w(e,"name",{value:t,configurable:!0});import{createRequire as v}from"node:module";import{z as b}from"
|
|
1
|
+
var w=Object.defineProperty;var m=(e,t)=>w(e,"name",{value:t,configurable:!0});import{createRequire as v}from"node:module";import{z as b}from"../packem_chunks/config.js";const k=v(import.meta.url),j=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=m(e=>{if(typeof j<"u"&&j.versions&&j.versions.node){const[t,r]=j.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return j.getBuiltinModule(e)}return k(e)},"__cjs_getBuiltinModule"),{createInterface:$}=_("node:readline");var T=Object.defineProperty,f=m((e,t)=>T(e,"name",{value:t,configurable:!0}),"g");const q=/^#([\w\-/]+):(.+)$/,x=/^([@\w\-/]+):(.+)$/,P=f(e=>{if(e==="")return;if(e.startsWith(":"))return{kind:"all",target:e.slice(1)};if(e.startsWith("~:"))return{kind:"closest",target:e.slice(2)};const t=q.exec(e);if(t?.[1]&&t[2])return{kind:"tag",tag:t[1],target:t[2]};const r=x.exec(e);return r?.[1]&&r[2]&&(r[1].startsWith("@")||r[1].includes("/")||r[1].includes("-"))?{kind:"project",projects:[r[1]],target:r[2]}:{kind:"all",target:e}},"parseTargetSelector"),N=f(async(e,t,r,a)=>{const s=P(e);if(!s)throw new Error(`Invalid target selector: "${e}"`);const c=Object.keys(t.projects);if(s.kind==="all")return{projects:c,target:s.target};if(s.kind==="project")return{projects:s.projects??[],target:s.target};if(s.kind==="tag"){const o=s.tag;return{projects:c.filter(i=>t.projects[i]?.tags?.includes(o)??!1),target:s.target}}const n=b(a,r)||".";let p,l=-1;for(const[o,i]of Object.entries(t.projects)){const u=i.root;u&&(n===u||n.startsWith(`${u}/`))&&u.length>l&&(l=u.length,p=o)}if(!p){if(process.stdout.isTTY){const o=$({input:process.stdin,output:process.stderr}),i=Object.keys(t.projects).sort();process.stderr.write(`No project found at ${n}. Pick one:
|
|
2
2
|
`);for(const[d,h]of i.entries())process.stderr.write(` ${String(d+1)}) ${h}
|
|
3
3
|
`);const u=await new Promise(d=>{o.question("> ",d)});o.close();const g=Number.parseInt(u,10)-1;if(g>=0&&g<i.length)return{projects:[i[g]],target:s.target}}throw new Error(`No project found at or above ${n} for selector "${e}".`)}return{projects:[p],target:s.target}},"resolveSelector"),E=/^(\w+)\s*(!?=)\s*(.+)$/,Q=f(e=>{const t=e.trim();if(t==="")return;const r=t.split("&&").map(o=>o.trim()),a=t.split("||").map(o=>o.trim()),s=r.length>1,c=a.length>1;if(s&&c)throw new Error("Query language does not support mixed && / || — split into multiple --query flags or simplify.");const n=c?a:r,p=c?"||":"&&",l=[];for(const o of n){const i=E.exec(o);if(!i)throw new Error(`Invalid query clause: "${o}". Expected <field>=<value> or <field>!=<value>.`);const[,u,g,d]=i;l.push({field:u,op:g==="!="?"!=":"=",value:d.trim().replaceAll(/^["']|["']$/g,"")})}return{clauses:l,op:p}},"parseQuery"),y=f((e,t,r)=>{const{field:a,op:s,value:c}=e,n=f(l=>{const o=l===c;return s==="="?o:!o},"test"),p=f(l=>{const o=(l??[]).includes(c);return s==="="?o:!o},"testList");switch(a){case"id":case"project":return n(t);case"language":return n(r.language);case"layer":return n(r.layer);case"projectType":case"type":return n(r.projectType);case"stack":return n(r.stack);case"tag":case"tags":return p(r.tags);default:return!1}},"matchClause"),O=f((e,t,r)=>{if(!r||r.trim()==="")return e;const a=Q(r);return a?e.filter(s=>{const c=t.projects[s];return c?a.op==="&&"?a.clauses.every(n=>y(n,s,c)):a.clauses.some(n=>y(n,s,c)):!1}):e},"filterProjectsByQuery");export{O as f,P as p,N as r};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var N=Object.defineProperty;var x=(o,e)=>N(o,"name",{value:e,configurable:!0});import{createRequire as I}from"node:module";import{M as d,a as g,$ as k,n as O,c as J,y as R}from"../packem_chunks/config.js";const B=I(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,j=x(o=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[e,n]=M.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return M.getBuiltinModule(o)}return B(o)},"__cjs_getBuiltinModule"),{execFileSync:w}=j("node:child_process"),{randomBytes:D}=j("node:crypto"),{writeFileSync:U,renameSync:q,unlinkSync:H}=j("node:fs");var z=Object.defineProperty,f=x((o,e)=>z(o,"name",{value:e,configurable:!0}),"f");const V=["proto","mise","fnm","volta","asdf","nvm","corepack"],Z={asdf:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],corepack:["npm","pnpm","yarn"],fnm:["node"],mise:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],nvm:["node"],proto:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],volta:["node","npm","pnpm","yarn"]},X=["proto","mise","fnm","volta","asdf","nvm","corepack"],W={asdf:[".tool-versions"],corepack:[],fnm:[".nvmrc",".node-version"],mise:[".mise.toml",".config/mise.toml","mise.toml"],nvm:[".nvmrc"],proto:[".prototools"],volta:[]},b=new Map,y=f(o=>{const e=b.get(o);if(e!==void 0||b.has(o))return e;const n=process.env.PATH;if(!n){b.set(o,void 0);return}const t=process.platform==="win32"?["",...(process.env.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";")]:[""];for(const r of n.split(J)){const a=r.replaceAll(/^["']|["']$/g,"").trim();if(a!=="")for(const l of t){const s=`${a}${R}${o}${l}`;if(g(s))return b.set(o,s),s}}b.set(o,void 0)},"isOnPath"),_=f((o,e=["--version"])=>{try{const n=w(o,e,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}),t=/\d+\.\d+(?:\.\d+)?/.exec(n);return t?t[0]:n.trim()||void 0}catch{return}},"queryManagerVersion"),A=f((o,e)=>{const n=d(o,"package.json");if(!g(n))return[];try{const t=O(n)[e];if(e==="volta"&&typeof t=="object"&&t!==null&&Object.keys(t).length>0)return["package.json"];if(e==="packageManager"&&typeof t=="string"&&t.length>0)return["package.json"]}catch{}return[]},"pkgFieldConfigFiles"),G=f((o,e)=>o==="volta"?A(e,"volta"):o==="corepack"?A(e,"packageManager"):W[o].filter(n=>g(d(e,n))),"configFilesFor"),P=new Map,K=f(()=>{P.clear(),b.clear()},"clearToolchainCache"),S=f((o,e)=>{if(!e?.refresh){const a=P.get(o);if(a)return a}const n=[],t=!!y("pnpm")||!!y("yarn");for(const a of X){const l=a==="nvm"?void 0:y(a),s=a==="nvm"&&!!process.env.NVM_DIR,c=G(a,o),i=!!l||s;a==="corepack"&&!i&&(!(c.length>0)||t)||!i&&c.length===0||n.push({binPath:l,configFiles:c,installed:i,name:a,version:l?_(l):void 0})}const r=Object.freeze(n);return P.set(o,r),r},"findInstalledManagers"),ye=f((o,e,n)=>{const t=n??S(o);return e?.preferredManager&&e.preferredManager!=="none"?t.find(r=>r.name===e.preferredManager)??{configFiles:[],installed:!1,name:e.preferredManager}:t.find(r=>r.installed&&r.configFiles.length>0)??t.find(r=>r.installed)??t.find(r=>r.configFiles.length>0)??{configFiles:[],installed:!1,name:"none"}},"pickPrimaryManager"),L=f((o,e)=>{for(const n of e){const t=d(o,n);if(g(t))try{const r=k(t).trim();if(r!=="")return{name:n,value:r.replace(/^v/,"")}}catch{}}},"readVersionFile"),Q=/^([a-z][\w-]*)\s*=\s*"?([^"\n#]+?)"?\s*(?:#.*)?$/i,Y=f(o=>{const e=d(o,".prototools");if(!g(e))return[];const n=k(e),t=[];let r=!1;for(const a of n.split(/\r?\n/)){const l=a.trim();if(l===""||l.startsWith("#"))continue;if(l.startsWith("[")){r=!0;continue}if(r)continue;const s=Q.exec(l);if(!s)continue;const[,c,i]=s,u=h(c);u&&t.push({source:".prototools",tool:u,version:i.trim()})}return t},"parsePrototools"),ee=/^\[tools\]\s*$/i,oe=/^([a-z][\w-]*)\s*=\s*"?([^"\n#]+?)"?\s*(?:#.*)?$/i,ne=f(o=>{for(const e of W.mise){const n=d(o,e);if(!g(n))continue;const t=[],r=k(n);let a=!1;for(const l of r.split(/\r?\n/)){const s=l.trim();if(s===""||s.startsWith("#"))continue;if(s.startsWith("[")){a=ee.test(s);continue}if(!a)continue;const c=oe.exec(s);if(!c)continue;const[,i,u]=c,m=h(i);m&&t.push({source:".mise.toml",tool:m,version:u.trim()})}if(t.length>0)return t}return[]},"parseMiseToml"),te=f(o=>{const e=d(o,".tool-versions");if(!g(e))return[];const n=k(e),t=[];for(const r of n.split(/\r?\n/)){const a=r.trim();if(a===""||a.startsWith("#"))continue;const l=a.split(/\s+/);if(l.length<2)continue;const[s,...c]=l,i=h(s);i&&c[0]&&t.push({source:".tool-versions",tool:i,version:c[0]})}return t},"parseToolVersions"),h=f(o=>{switch(o.toLowerCase()){case"bun":return"bun";case"deno":return"deno";case"go":case"golang":return"go";case"node":case"nodejs":return"node";case"npm":return"npm";case"pnpm":return"pnpm";case"python":case"python3":return"python";case"ruby":return"ruby";case"rust":case"rustc":return"rust";case"yarn":return"yarn";default:return}},"normalizeToolName"),re=f(o=>{const[e]=o.split("+",1),n=/^(pnpm|yarn|npm|bun)@(.+)$/.exec(e??"");if(!n)return;const t=h(n[1]);if(t)return{source:"packageManager",tool:t,version:n[2]}},"parsePackageManagerField"),se=f((o,e)=>{const n=new Map,t=f(s=>{n.set(s.tool,s)},"add"),r=d(o,"package.json");let a={};try{g(r)&&(a=O(r))}catch{}if(a.engines)for(const[s,c]of Object.entries(a.engines)){const i=h(s);i&&typeof c=="string"&&t({source:"engines",tool:i,version:c})}if(a.packageManager){const s=re(a.packageManager);s&&t(s)}if(a.volta)for(const[s,c]of Object.entries(a.volta)){const i=h(s);i&&typeof c=="string"&&t({source:"volta",tool:i,version:c})}const l=L(o,[".nvmrc",".node-version"]);l&&t({source:l.name===".nvmrc"?".nvmrc":".node-version",tool:"node",version:l.value});for(const s of te(o))t(s);for(const s of ne(o))t(s);for(const s of Y(o))t(s);if(e?.tools)for(const[s,c]of Object.entries(e.tools)){const i=h(s);i&&typeof c=="string"&&t({source:"vis.config.ts",tool:i,version:c})}return[...n.values()]},"parseExpectedTools"),F={bun:{args:["--version"],binaries:["bun"]},deno:{args:["--version"],binaries:["deno"]},go:{args:["version"],binaries:["go"]},node:{args:["--version"],binaries:["node"]},npm:{args:["--version"],binaries:["npm"]},pnpm:{args:["--version"],binaries:["pnpm"]},python:{args:["--version"],binaries:["python","python3"]},ruby:{args:["--version"],binaries:["ruby"]},rust:{args:["--version"],binaries:["rustc"]},yarn:{args:["--version"],binaries:["yarn"]}},ae=f(o=>{const e=F[o];for(const n of e.binaries){const t=y(n);if(t)return _(t,e.args)}if(o==="node")return process.versions.node},"queryToolVersion"),ie=f((o,e)=>{const n=e.trim();if(n===""||n==="*"||n==="latest")return!0;if(/^\d[\d.]*$/.test(n))return o===n||o.startsWith(`${n}.`);const t=f(s=>s.split(/[.\-+]/).map(c=>Number.parseInt(c,10)||0),"parse"),r=f((s,c)=>{const i=t(s),u=t(c),m=Math.max(i.length,u.length);for(let p=0;p<m;p++){const $=i[p]??0,v=u[p]??0;if($!==v)return $-v}return 0},"compare"),a=f(s=>{for(const c of s)if(c.startsWith(">=")){if(r(o,c.slice(2).trim())<0)return!1}else if(c.startsWith("<=")){if(r(o,c.slice(2).trim())>0)return!1}else if(c.startsWith(">")){if(r(o,c.slice(1).trim())<=0)return!1}else if(c.startsWith("<")){if(r(o,c.slice(1).trim())>=0)return!1}else if(c.startsWith("^")||c.startsWith("~")){const i=c.slice(1).trim(),[u,m]=t(i),[p,$]=t(o);if(p!==u||c.startsWith("~")&&$!==m||r(o,i)<0)return!1}return!0},"matchesAll"),l=n.split("||").map(s=>s.trim().split(/\s+/).filter(Boolean)).filter(s=>s.length>0);return l.length===0?!0:l.some(s=>a(s))},"satisfies"),ce=f((o,e)=>{switch(o){case".mise.toml":return["mise"];case".node-version":case".nvmrc":return["fnm","nvm","volta","proto","mise","asdf"];case".prototools":return["proto"];case".tool-versions":return["asdf","mise"];case"packageManager":return e==="pnpm"||e==="yarn"?["self-activate","volta","proto","mise","corepack"]:e==="npm"?["volta","proto","mise","asdf","corepack"]:e==="bun"?["proto","mise","asdf"]:["volta","proto","mise"];case"volta":return["volta"];default:return["proto","mise","fnm","volta","asdf","nvm","corepack"]}},"preferenceFor"),le=f((o,e,n)=>{if(n?.preferredManager&&n.preferredManager!=="none"&&T(n.preferredManager,o.tool)){const r=e.find(a=>a.name===n.preferredManager);return r?{installed:r.installed,name:r.name}:{installed:!1,name:n.preferredManager,note:`${n.preferredManager} is the preferred manager but isn't on PATH`}}const t=ce(o.source,o.tool);for(const r of t){if(r==="self-activate"){if((o.tool==="pnpm"||o.tool==="yarn")&&y(o.tool))return{installed:!0,name:"self-activate",note:`${o.tool} will activate ${o.version} from the packageManager field on next invocation`};continue}if(T(r,o.tool)&&e.find(a=>a.name===r)?.installed)return{installed:!0,name:r}}for(const r of t)if(!(r==="self-activate"||!T(r,o.tool)))return{installed:!1,name:r,note:`${r} can install ${o.tool} — run \`vis toolchain install\` after adding it to PATH`};return{installed:!1,name:"none",note:"No manager knows how to install this tool"}},"resolveManagerFor"),T=f((o,e)=>o==="none"?!1:o==="self-activate"?e==="pnpm"||e==="yarn":Z[o].includes(e),"canHandle"),fe=f((o,e)=>{const n=S(o),t=se(o,e).map(r=>{const a=ae(r.tool),l=a!==void 0&&ie(a,r.version),s=le(r,n,e);return{actual:a,expected:r,manager:s,matches:l}});return{detected:n,tools:t}},"getToolchainStatus"),pe=f((o,e)=>{switch(o){case"asdf":return e?{args:["install",e.tool,e.version],bin:"asdf"}:void 0;case"corepack":return e?{args:["prepare",`${e.tool}@${e.version}`,"--activate"],bin:"corepack"}:{args:["prepare","--activate"],bin:"corepack",hint:"reads the packageManager field in package.json"};case"fnm":return e?.tool!=="node"?void 0:{args:["install",e.version],bin:"fnm"};case"mise":return e?{args:["install",`${e.tool}@${e.version}`],bin:"mise"}:void 0;case"none":return;case"nvm":return{args:[],bin:"nvm",hint:"nvm is a shell function — run `nvm install` / `nvm use` from your shell"};case"proto":return e?{args:["install",e.tool,e.version],bin:"proto"}:void 0;case"self-activate":return{args:[],bin:e?.tool??"pnpm",hint:`${e?.tool??"pnpm"} will self-activate on next invocation — no install needed`};case"volta":return e?{args:["install",`${e.tool}@${e.version}`],bin:"volta"}:{args:["install","node@lts"],bin:"volta",hint:"volta pins per-tool; specify <tool>@<version>"};default:{const n=o;throw new Error(`Unknown manager: ${n}`)}}},"buildInstallInvocation"),$e=f((o,e)=>{switch(o){case"asdf":return{args:["local",e.tool,e.version],bin:"asdf",configChange:{file:".tool-versions",hint:`Pins ${e.tool} ${e.version}`}};case"corepack":return e.tool!=="npm"&&e.tool!=="pnpm"&&e.tool!=="yarn"?void 0:{args:["use",`${e.tool}@${e.version}`],bin:"corepack",configChange:{file:"package.json",hint:`Writes packageManager: "${e.tool}@${e.version}"`}};case"fnm":return e.tool==="node"?{args:["use",e.version],bin:"fnm"}:void 0;case"mise":return{args:["use","--",`${e.tool}@${e.version}`],bin:"mise",configChange:{file:".mise.toml",hint:`Pins ${e.tool} ${e.version}`}};case"none":return;case"nvm":return e.tool==="node"?{args:[],bin:"nvm",configChange:{file:".nvmrc",hint:"Write version to .nvmrc manually (nvm doesn't persist)."}}:void 0;case"proto":return{args:["pin",e.tool,e.version],bin:"proto",configChange:{file:".prototools",hint:`Pins ${e.tool} ${e.version}`}};case"self-activate":return{args:[],bin:e.tool,configChange:{file:"package.json",hint:`Set packageManager: "${e.tool}@${e.version}" — ${e.tool} will self-activate on next invocation`}};case"volta":return{args:["pin",`${e.tool}@${e.version}`],bin:"volta",configChange:{file:"package.json",hint:`Writes volta.${e.tool}`}};default:{const n=o;throw new Error(`Unknown manager: ${n}`)}}},"buildUseInvocation"),be=f(o=>{for(const e of F[o].binaries){const n=y(e);if(n)return n}},"findOnPathByAlias"),ke=f((o,e)=>{const n=F[e].binaries;if(o.installed&&o.binPath&&(o.name==="proto"||o.name==="mise"||o.name==="asdf"||o.name==="volta"||o.name==="fnm"))for(const t of n)try{const r=w(o.binPath,["which",t],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}).trim();if(r)return r}catch{}for(const t of n){const r=y(t);if(r)return r}},"resolveToolBinary"),E=f((o,e)=>{const n=`${o}.${process.pid}.${D(6).toString("hex")}.tmp`;U(n,e);try{q(n,o)}catch(t){try{H(n)}catch{}throw t}},"atomicWrite"),ue=f((o,e)=>{if("packageManager"in o)return o.packageManager=e,o;const n={};let t=!1;for(const[r,a]of Object.entries(o))!t&&(r==="dependencies"||r==="devDependencies"||r==="peerDependencies"||r==="optionalDependencies")&&(n.packageManager=e,t=!0),n[r]=a;return t||(n.packageManager=e),n},"insertPackageManagerKey"),Me=f((o,e)=>{if(e.tool!=="pnpm"&&e.tool!=="yarn"&&e.tool!=="npm"&&e.tool!=="bun")return;const n=d(o,"package.json");if(!g(n))throw new Error(`Cannot pin ${e.tool}: ${n} does not exist.`);const t=k(n),r=/\n([ \t]+)/.exec(t)?.[1]??" ";let a;try{a=JSON.parse(t)}catch(i){throw new Error(`${n} is not valid JSON — fix it before running \`vis toolchain use\`. Underlying error: ${i.message}`,{cause:i})}const l=`${e.tool}@${e.version}`,s=ue(a,l),c=t.endsWith(`
|
|
2
|
+
`)?`
|
|
3
|
+
`:"";return E(n,`${JSON.stringify(s,void 0,r)}${c}`),l},"writePackageManagerField"),we=f((o,e)=>{const n=d(o,"package.json");if(!g(n))return;const t=k(n);let r;try{r=JSON.parse(t)}catch(s){throw new Error(`${n} is not valid JSON — fix it before running \`vis toolchain use\`. Underlying error: ${s.message}`,{cause:s})}if(r.engines?.[e.tool]===void 0||r.engines[e.tool]===e.version)return;r.engines[e.tool]=e.version;const a=/\n([ \t]+)/.exec(t)?.[1]??" ",l=t.endsWith(`
|
|
4
|
+
`)?`
|
|
5
|
+
`:"";return E(n,`${JSON.stringify(r,void 0,a)}${l}`),e.version},"updateEnginesField"),xe=f(o=>{const e=/^([a-z][\w-]*)@(.+)$/i.exec(o.trim());if(!e)return;const n=h(e[1]);if(n)return{source:"vis.config.ts",tool:n,version:e[2]}},"parseUseArgument"),ge=f(async(o,e,n)=>{const t=fe(o,e),r=t.tools.filter(i=>!i.matches);if(r.length===0)return{attempted:[],failed:[],upToDate:!0};const a=t.detected.some(i=>i.installed);if(!(e?.autoInstall??a))return{attempted:[],failed:[],upToDate:!1};const l=[],s=[],c=new Map;for(const i of r){const u=c.get(i.manager.name);u?u.push(i):c.set(i.manager.name,[i])}for(const[i,u]of c){if(i==="self-activate"){for(const{expected:p}of u)n.info(`toolchain: ${p.tool} ${p.version} will self-activate on next ${p.tool} invocation`),l.push(p);continue}if(i==="none"){for(const{expected:p}of u)s.push({error:`no manager can install ${p.tool} — install one of ${V.join(", ")}`,spec:p});continue}if(!t.detected.find(p=>p.name===i)?.installed){for(const{expected:p}of u)s.push({error:`${i} is not on PATH`,spec:p});continue}const m=u.map(p=>({invocation:pe(i,p.expected),tool:p})).filter(p=>p.invocation!==void 0);for(const{invocation:p,tool:$}of m){const{expected:v}=$;if(p.bin==="nvm"&&p.args.length===0){n.warn(`toolchain: nvm requires a shell-side activation for ${v.tool} ${v.version}. Run \`nvm install\` / \`nvm use\` manually.`),s.push({error:"nvm requires shell-side activation",spec:v});continue}n.info(`toolchain: $ ${p.bin} ${p.args.join(" ")}`);try{w(p.bin,p.args,{cwd:o,stdio:"inherit"}),l.push(v),i==="fnm"&&de(p.bin,n)}catch(C){s.push({error:C.message,spec:v});break}}}return K(),{attempted:l,failed:s,upToDate:!1}},"ensureToolchain"),Te=f(async(o,e,n,t=!1)=>{if(t)return;const r=await ge(o,e,n);for(const a of r.failed)n.warn(`toolchain: ${a.spec.tool} ${a.spec.version} — ${a.error}`)},"runToolchainPreflight"),de=f((o,e)=>{const n=process.platform==="win32"?"powershell":"bash";try{const t=w(o,["env","--shell",n],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3});for(const r of t.split(/\r?\n/)){const a=r.trim();if(a==="")continue;const l=/^\$env:([A-Z_]\w*)\s*=\s*(.+)$/i.exec(a);if(l){const[,i,u]=l;process.env[i]=u.replaceAll(/^["']|["']$/g,"");continue}const s=/^set\s+"?([A-Z_]\w*)=(.*?)"?$/i.exec(a);if(s){const[,i,u]=s;process.env[i]=u;continue}const c=/^(?:export\s+)?([A-Z_]\w*)=(.+)$/i.exec(a);if(c){const[,i,u]=c;process.env[i]=u.replaceAll(/^["']|["']$/g,"")}}}catch(t){e.warn(`toolchain: could not activate fnm env (${t.message}). Subsequent tasks may use the previous Node version.`)}},"activateFnmEnv");export{V as S,le as a,pe as b,$e as c,ke as d,be as e,S as f,fe as g,ye as h,xe as p,Te as r,we as u,Me as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var q=Object.defineProperty;var l=(e,s)=>q(e,"name",{value:s,configurable:!0});import{createRequire as $}from"node:module";import{aH as M,p as i,d as b,e as k}from"../packem_chunks/bin.js";import{M as C,a as D,n as A}from"../packem_chunks/config.js";const z=$(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=l(e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[s,r]=m.versions.node.split(".").map(Number);if(s>22||s===22&&r>=3||s===20&&r>=16)return m.getBuiltinModule(e)}return z(e)},"__cjs_getBuiltinModule"),{createInterface:T}=_("node:readline");var O=["aj","aju","av","avj","ejv","jav","jv"],F=["angula","angular-node","angularjs"],N=["auto-prefixer"],P=["aaxios","aios","axio","axioos","axios-node","axioss","axis","axiso","axois","axos","axxios"],B=["abel","babbel","babe","babel-js","babel-node","babl","bable","bbael","bebel"],R=["bcrpyt","bcrypt-node","brcypt","crypt","dcrypt"],S=["bcryptjs-node","dcryptjs"],W=["bunan","bunya","bunyan-node","buynan"],L=["cai","cha","chaijs","chal","chi","chia","hai"],E=["cahlk","calk","cchalk","ch4lk","cha1k","chaalk","chaik","chak","chakl","chalk-node","chalkk","challk","chhalk","chlak","chlk","halk","hcalk"],U=["cheero","cherio"],V=["c0lor","ccolor","clor","colo","coloor","color-js","colorjs","colorr","colr","coolor","coolr"],H=["ccolors","colors-node","colorss","colorz","colrs","coolors"],I=["c0mmander","ccommander","cmmander","cmomander","co-mmander","comamnder","comander","comm4nder","commaander","commader","commadner","commamder","command3r","commandder","commande","commandeer","commander-js","commanderr","commandr","commandre","commanedr","commaner","commannder","commender","commmander","commnader","commnder","coommander","ocmmander","ommander"],J=["cor","corss","cos","cosr","cros","crs","ors"],Y=["days"],G=["d3bug","dbeug","dbug","ddebug","debbug","debg","debgu","debu","debu9","debug-js","debug-node","debugg","debugjs","debuug","deebug","deubg","deug","ebug","edbug"],K=["dot-env","dotenv-node","dotenvjs","dotevn"],Q=["3lectron","eectron","eelctron","eelectron","el3ctron","elcetron","elctron","elecctron","elecron","elecrton","electon","electorn","electr0n","electrn","electrno","electro","electrom","electron-node","electronn","electroon","electrron","electtron","eleectron","eletcron","eletron","ellectron","lectron","leectron"],X=["asbuild","ebuild","esbuild-node","esbuildjs","ezbuild","sbuild"],Z=["aslint","elint","eslint-js","eslint-node","eslit","ezlint","slint"],ee=["eexpress","epress","epxress","experss","expess","exppress","expreess","expres","express-node","expressjs","expresss","exprress","exprses","exprss","exress","exrpess","exxpress","xepress","xpress"],oe=["astify"],se=["firebasejs"],re=["form1dable"],ae=["glb","glo","glob-js","globjs","gob","golb","lob"],te=["go","goot","gotjs","gott","gt","gto","ogt","ot","qot"],ne=["helmetjs","helnet"],ce=["homo","hon","hoo","hoon","ohno","ono"],ie=["inquire","inquirer-js","nquirer"],de=["iredis"],me=["ejst","est","jast","jes","jestjs","jestt","jet","jets","jst"],le=["imp","jim","jip","jmp"],pe=["ji","jio","jo","joii","jol","oi","oji"],ue=["jdom","jsdm","jsdo","jsdom-js","jsdon","jsom","sdom"],ve=["jsonwebtoken-js","jsonwebtoken-node"],he=["ka","kao","ko","koaa","koajs","koe","oa","oka"],je=["1odash","iodash","l0dash","ldash","ldoash","llodash","lo-dash","loadsh","loash","lobash","lod4sh","lodaash","lodah","lodahs","lodas","lodash-node","lodashh","lodassh","loddash","lodesh","lodsah","lodsh","loodash","odash","oldash"],be=["luca","luci","lucie"],ke=["luon","luxo","luxon-js"],ge=["imcromatch","mciromatch","micormatch","micrmoatch","micro-match","microamtch","micromacth","micromathc","micromtach","mircomatch"],fe=["minimath"],ye=["mcha","mmocha","moca","moch","mocha-js","moha","nocha","ocha"],xe=["m0ment","mment","mmoent","mmoment","moemnt","moent","mom3nt","momeent","momemt","momen","momen7","momennt","moment-js","momentjs","momentt","momet","mometn","momment","momnet","momnt","monent","mooment","oment","omment"],we=["mognoose","mogoose","mongoos","mongose","monqoose","moongoose"],qe=["moran","organ"],$e=["muler","multer-js","muter"],ze=["mysql"],_e=["ext","mext","n3xt","naxt","net","netx","nex","next-js","next-node","nextjs","nxt"],Te=["node-mailer","nodemailer-js"],Me=["nodemo","nodemonjs","nodmeon"],Ce=["oar","or","ora-node","ore","ra","roa"],De=["arcel","parce","parceljs"],Ae=["passport-js"],Oe=["phase","phaser-node"],Fe=["ino","pimo","pin","pino-node","pinojs","pio","pion"],Ne=["playright","playwright-js"],Pe=["postcss-js","postcss-node","potscss"],Be=["pettier","pprettier","pretier","prettierjs","prettierr","prtetier"],Re=["prima","prism","prisma-js","prismajs","prizma"],Se=["pupeteer"],We=["rada","rama","ramd","randa"],Le=["eact","eract","r3act","raact","ract","raect","re4ct","reaact","reac","reac7","reacct","react-node","reactjs","reactt","reat","reatc","recat","rect","reeact","reect","rreact"],Ee=["erdis","radis","rdis","redi","redis-js","redis-node","rediss","rediz","reds","reis","rredis"],Ue=["resen","rsend"],Ve=["ollup","rollup-js","rollup-node"],He=["ass","asss","sas","sass-node","sess","ssas","sss"],Ie=["emver","seemver","semver-node","semvre","senver","sever"],Je=["sequelize-js","sequelize-node"],Ye=["harp","shap","shar","sharp-js","sharpjs"],Ge=["stipe","strip","stripe-node","tripe"],Ke=["supabase-js"],Qe=["suelte","svelt3","svelte-js","sveltejs","velte"],Xe=["tailwindcss-js"],Ze=["auri","taui"],eo=["hree","htree","thee","there","three-js","three-node","tree"],oo=["stx","sx","ts","tsxx","ttsx","tx","txs","tzx"],so=["ttypescript","typecript","typescipt","typescript-node","typescriptjs","typescrit","typescritp"],ro=["udnerscore","undercore","underscoer","underscore-node","underscroe","undersocre","undesrcore"],ao=["uid","uud","uudi","uui","uuid-js","uuid-node","uuidjs","vuid"],to=["ite","vie","vit","vita","vite-node","vitee","vlte","vte"],no=["itest","uitest","vitestjs","vitezt","vittest","vtest"],co=["ue","uue","uve","ve","veu","vu","vu3","vua","vue-node","vuee","vuejs","vuue","vve","vvue"],io=["web-pack","weback","webpac","webpack-node","webpackjs","webpak","weebpack","wepack","wepback"],mo=["winson","winston-js","winstoon"],lo=["up","uyp","yp","yu","yupjs","yupp"],po=["od","zd","zdo","zo","zob","zod-js","zodjs"];const uo={ajv:O,angular:F,autoprefixer:N,"aws-sdk":["awssdk","ews-sdk"],axios:P,babel:B,bcrypt:R,bcryptjs:S,"body-parser":["body-paresr","body-parse","body-parser-js","body_parser"],bunyan:W,chai:L,chalk:E,cheerio:U,color:V,colors:H,commander:I,"cookie-parser":["cookie-parse","cookieparser"],cors:J,"cross-env":["crossenv"],"date-fns":["data-fns","date-fn"],dayjs:Y,debug:G,dotenv:K,electron:Q,esbuild:X,eslint:Z,express:ee,fastify:oe,firebase:se,formidable:re,glob:ae,got:te,helmet:ne,hono:ce,inquirer:ie,ioredis:de,jest:me,jimp:le,joi:pe,jsdom:ue,jsonwebtoken:ve,koa:he,lodash:je,lucia:be,luxon:ke,micromatch:ge,minimatch:fe,mocha:ye,moment:xe,mongoose:we,morgan:qe,multer:$e,mysql2:ze,next:_e,"node-fetch":["node-fecth","node-fethc","node.fetch"],nodemailer:Te,nodemon:Me,ora:Ce,parcel:De,passport:Ae,phaser:Oe,pino:Fe,playwright:Ne,postcss:Pe,prettier:Be,prisma:Re,puppeteer:Se,ramda:We,react:Le,"react-dom":["eact-dom","eract-dom","r3act-dom","ract-dom","raect-dom","re4ct-dom","reaact-dom","reac-dom","reac7-dom","reacct-dom","react-bom","react-d0m","react-ddom","react-dm","react-dmo","react-do","react-domm","react-don","react-doom","react-odm","react-om","react.dom","reactdom","reactt-dom","reat-dom","reatc-dom","recat-dom","rect-dom","reeact-dom","rreact-dom"],redis:Ee,resend:Ue,rollup:Ve,sass:He,semver:Ie,sequelize:Je,sharp:Ye,"socket.io":["ocket.io","oscket.io","scket.io","scoket.io","soccket.io","socekt.io","socet.io","sock3t.io","socke.io","socke7.io","sockeet.io","socket.1o","socket.i","socket.iio","socket.ioo","socket.lo","socket.o","socket.oi","sockett.io","sockket.io","sockt.io","sockte.io","sokcet.io","soket.io","soocket.io","ssocket.io"],stripe:Ge,supabase:Ke,svelte:Qe,tailwindcss:Xe,tauri:Ze,three:eo,"ts-node":["tts-node"],tsx:oo,typescript:so,underscore:ro,uuid:ao,vite:to,vitest:no,vue:co,webpack:io,winston:mo,yup:lo,zod:po};var v,g;function vo(){return g||(g=1,v={"@tanstack/start":["start-tanstack-app","tanstack","tanstack-app","tanstack-start"]}),v}l(vo,"requireTyposquatsManual");var ho=vo();const jo=M(ho);var bo=Object.defineProperty,n=l((e,s)=>bo(e,"name",{value:s,configurable:!0}),"c");const ko={a:["4","e"],b:["d"],d:["b"],e:["3","a"],g:["9","q"],i:["1","l"],l:["1","i"],m:["n"],n:["m"],o:["0"],s:["5","z"],t:["7"],u:["v"],v:["u"]},go=["app","cli","core","kit","lib","pkg","sdk"],fo=n(e=>{const s=new Set;if(e.length<3)return s;for(let o=0;o<e.length;o++){const a=e[o],t=a==="-"||a==="."||a==="_";if(t||s.add(e.slice(0,o)+e.slice(o+1)),t||s.add(e.slice(0,o)+a+e.slice(o)),o<e.length-1&&e[o]!==e[o+1]){const u=e[o+1]==="-"||e[o+1]==="."||e[o+1]==="_";if(!t&&!u){const d=[...e];[d[o],d[o+1]]=[d[o+1],d[o]],s.add(d.join(""))}}const c=e[o].toLowerCase(),j=ko[c];if(j)for(const u of j)s.add(e.slice(0,o)+u+e.slice(o+1))}const r=/[-._]/g;if(r.test(e))s.add(e.replaceAll(r,"")),s.add(e.replaceAll(r,"-")),s.add(e.replaceAll(r,".")),s.add(e.replaceAll(r,"_"));else if(e.length>5)for(let o=2;o<e.length-2;o++)s.add(`${e.slice(0,o)}-${e.slice(o)}`),s.add(`${e.slice(0,o)}.${e.slice(o)}`),s.add(`${e.slice(0,o)}_${e.slice(o)}`);if(e.startsWith("@")||(s.add(`${e}-js`),s.add(`${e}js`),s.add(`${e}-node`)),e.startsWith("@")){const o=e.indexOf("/");if(o>1&&o<e.length-1){const a=e.slice(1,o),t=e.slice(o+1);a.length>=3&&s.add(a);for(const c of["","-",".","_"])s.add(`${a}${c}${t}`),s.add(`${t}${c}${a}`);for(const c of go)s.add(`${a}-${c}`),s.add(`${t}-${a}-${c}`),s.add(`${c}-${a}-${t}`)}}return s.delete(e),s},"generateVariants");let h,p;const f=n(()=>{if(!h){const e={};for(const s of[uo,jo])for(const[r,o]of Object.entries(s)){const a=e[r]??(e[r]=[]);for(const t of o)a.includes(t)||a.push(t)}h=e}return h},"loadBlocklist"),yo=n(()=>{if(!p){p=new Map;for(const[e,s]of Object.entries(f()))for(const r of s)p.set(r,e)}return p},"getReverseLookup"),xo=n(e=>e.startsWith("@")?e.split("/")[1]??e:e,"bareName"),wo=n(e=>{const s=xo(e),r=yo().get(s);if(r)return{input:e,legitimate:r,method:"blocklist"};for(const o of Object.keys(f()))if(fo(o).has(s))return{input:e,legitimate:o,method:"heuristic"}},"checkTyposquat"),y=n((e,s)=>{const r=s?new Set(s):void 0,o=[];for(const a of e){if(r?.has(a))continue;const t=wo(a);t&&o.push(t)}return o},"checkTyposquats"),x=n((e,s)=>{i.warn(""),i.warn(b(`Possible typosquat${e.length===1?"":"s"} ${s}:`));for(const r of e){const o=r.method==="blocklist"?"known typosquat":"similar name";i.warn(` ${k("⚠")} ${b(r.input)} — did you mean ${k(r.legitimate)}? (${o})`)}i.warn("")},"printTyposquatWarnings"),w=n(async e=>{if(!process.stdin.isTTY){i.warn("Aborting: potential typosquat detected in non-interactive mode. Use --no-typosquat-check to skip.");return}const s=T({input:process.stdin,output:process.stdout}),r=await new Promise(o=>{s.question(e,a=>{o(a.trim().toLowerCase())})});return s.close(),r},"askConfirmation"),Do=n(async(e,s)=>{const r=y(e,s);if(r.length===0)return{ok:!0,packages:e};x(r,"detected");const o=await w(`Use suggested package${r.length===1?"":"s"} instead? [S]uggested / [y]es, keep original / [N]o, abort (default: N) `);if(o===void 0)return{ok:!1,packages:e};if(o==="s"||o==="suggested"){const a=new Map(r.map(t=>[t.input,t.legitimate]));return{ok:!0,packages:e.map(t=>a.get(t)??t)}}return o==="y"||o==="yes"?{ok:!0,packages:e}:{ok:!1,packages:e}},"runTyposquatCheck"),qo=/^(?:npm|pnpm|yarn):(.+?)(?:@.*)?$/,$o=n(e=>qo.exec(e)?.[1],"parseAliasTarget"),zo=n(e=>{if(!D(e))return[];const s=A(e),r={...s.dependencies,...s.devDependencies,...s.optionalDependencies,...s.peerDependencies},o=new Set;for(const[a,t]of Object.entries(r)){o.add(a);const c=$o(t);c&&o.add(c)}return[...o]},"readDepsFromPackageJson"),Ao=n(async(e,s)=>{const r=C(e,"package.json"),o=zo(r);if(o.length===0)return!0;const a=y(o,s);if(a.length===0)return!0;x(a,"in package.json dependencies"),i.warn("Fix the package name in package.json before proceeding.");const t=await w("Continue anyway? [y/N] ");return t==="y"||t==="yes"},"scanDepsForTyposquats");export{Do as r,Ao as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var u=Object.defineProperty;var g=(n,s)=>u(n,"name",{value:s,configurable:!0});import{createRequire as m}from"node:module";import{M as i,a,$ as f}from"../packem_chunks/config.js";import{u as $}from"../packem_chunks/bin.js";const j=m(import.meta.url),k=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=g(n=>{if(typeof k<"u"&&k.versions&&k.versions.node){const[s,o]=k.versions.node.split(".").map(Number);if(s>22||s===22&&o>=3||s===20&&o>=16)return k.getBuiltinModule(n)}return j(n)},"__cjs_getBuiltinModule"),{readdirSync:v}=b("node:fs");var w=Object.defineProperty,l=g((n,s)=>w(n,"name",{value:s,configurable:!0}),"o");const _=[".husky/pre-commit",".vis-hooks/pre-commit",".git/hooks/pre-commit"],D=[".secretlintrc",".secretlintrc.json",".secretlintrc.js",".secretlintrc.mjs",".secretlintrc.cjs",".secretlintrc.yml",".secretlintrc.yaml"],S=[".syncpackrc",".syncpackrc.json",".syncpackrc.yaml",".syncpackrc.yml",".syncpackrc.cjs",".syncpackrc.js",".syncpackrc.mjs",".syncpackrc.ts","syncpack.config.cjs","syncpack.config.js","syncpack.config.mjs","syncpack.config.ts"],M=l(n=>{const s=i(n,"package.json");if(!a(s))return[];let o;try{o=JSON.parse(f(s))}catch{return[]}const e=[];if(o.scripts)for(const[t,c]of Object.entries(o.scripts))typeof c=="string"&&(/\bgitleaks\b/.test(c)&&e.push({detail:`Script "${t}" still invokes gitleaks: ${c}`,kind:"script",location:"package.json",tool:"gitleaks"}),/\bsecretlint\b/.test(c)&&e.push({detail:`Script "${t}" still invokes secretlint: ${c}`,kind:"script",location:"package.json",tool:"secretlint"}),/\bsyncpack\b/.test(c)&&e.push({detail:`Script "${t}" still invokes syncpack: ${c}`,kind:"script",location:"package.json",tool:"syncpack"}),/\bsherif\b/.test(c)&&e.push({detail:`Script "${t}" still invokes sherif: ${c}`,kind:"script",location:"package.json",tool:"sherif"}));if(o.devDependencies)for(const t of Object.keys(o.devDependencies))(t==="gitleaks"||t==="@gitleaks/cli")&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"gitleaks"}),(t==="secretlint"||t.startsWith("@secretlint/"))&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"secretlint"}),t==="syncpack"&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"syncpack"}),t==="sherif"&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"sherif"});return o.sherif&&e.push({detail:"`sherif` config block still present in package.json",kind:"config",location:"package.json",tool:"sherif"}),e},"scanPackageJson"),O=l(n=>{const s=[];for(const o of _){const e=i(n,o);if(!a(e))continue;const t=f(e);/\bgitleaks\b/.test(t)&&s.push({detail:"gitleaks invocation still present in hook",kind:"hook",location:o,tool:"gitleaks"}),/\bsecretlint\b/.test(t)&&s.push({detail:"secretlint invocation still present in hook",kind:"hook",location:o,tool:"secretlint"}),/\bsyncpack\b/.test(t)&&s.push({detail:"syncpack invocation still present in hook",kind:"hook",location:o,tool:"syncpack"}),/\bsherif\b/.test(t)&&s.push({detail:"sherif invocation still present in hook",kind:"hook",location:o,tool:"sherif"})}return s},"scanHooks"),C=l(n=>{const s=[];for(const o of D)a(i(n,o))&&s.push({detail:"secretlint config should be removed after migration",kind:"config",location:o,tool:"secretlint"});for(const o of S)a(i(n,o))&&s.push({detail:"syncpack config should be removed after migration",kind:"config",location:o,tool:"syncpack"});return s},"scanConfigs"),N=[".github/workflows",".gitlab-ci.yml",".circleci/config.yml",".woodpecker.yml",".drone.yml"],q=l(n=>{const s=[],o=l(e=>{const t=i(n,e);if(!a(t))return;const c=f(t);/\bsyncpack\b/.test(c)&&s.push({detail:"syncpack invocation still present in CI",kind:"ci",location:e,tool:"syncpack"}),/\bsherif\b/.test(c)&&s.push({detail:"sherif invocation still present in CI",kind:"ci",location:e,tool:"sherif"})},"scanFile");for(const e of N){const t=i(n,e);if(a(t)){if(e===".github/workflows"){try{for(const c of v(t))(c.endsWith(".yml")||c.endsWith(".yaml"))&&o(`.github/workflows/${c}`)}catch{}continue}o(e)}}return s},"scanCi"),I=l(n=>{const s=[],o=i(n,"pnpm-workspace.yaml");if(a(o)){let t;try{t=$(o)}catch{t=void 0}if(t&&typeof t=="object"){const c=t.catalog;c&&typeof c.syncpack=="string"&&s.push({detail:"`syncpack` still listed in pnpm-workspace.yaml#catalog",kind:"catalog",location:"pnpm-workspace.yaml",tool:"syncpack"});const r=t.catalogs;if(r&&typeof r=="object")for(const[d,p]of Object.entries(r))p&&typeof p.syncpack=="string"&&s.push({detail:`\`syncpack\` still listed in pnpm-workspace.yaml#catalogs.${d}`,kind:"catalog",location:"pnpm-workspace.yaml",tool:"syncpack"})}}const e=i(n,"package.json");if(a(e)){let t;try{t=JSON.parse(f(e))}catch{return s}const c=t.workspaces;if(c&&typeof c=="object"&&!Array.isArray(c)){const d=c.catalog;d&&typeof d.syncpack=="string"&&s.push({detail:"`syncpack` still listed in package.json#workspaces.catalog",kind:"catalog",location:"package.json",tool:"syncpack"});const p=c.catalogs;if(p&&typeof p=="object")for(const[h,y]of Object.entries(p))y&&typeof y.syncpack=="string"&&s.push({detail:`\`syncpack\` still listed in package.json#workspaces.catalogs.${h}`,kind:"catalog",location:"package.json",tool:"syncpack"})}const r=t.catalog;r&&typeof r.syncpack=="string"&&s.push({detail:"`syncpack` still listed in package.json#catalog",kind:"catalog",location:"package.json",tool:"syncpack"})}return s},"scanCatalogs"),J=l(n=>[...M(n),...O(n),...C(n),...q(n),...I(n)],"scanMigrationLeftovers"),B=l((n,s)=>{const o=J(n);if(o.length===0)return s.info("✓ No unmigrated gitleaks/secretlint/sherif/syncpack references found."),[];s.warn(`Found ${String(o.length)} unmigrated reference(s):`);for(const e of o)s.warn(` [${e.kind}] ${e.location} — ${e.detail}`);return o},"verifyMigration");export{J as s,B as v};
|