tinker-node-manager 0.1.0 → 0.1.1

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/README.md CHANGED
@@ -19,7 +19,9 @@ Download and install TINKER from `https://tinker.liriliri.io/`, then run `npm i
19
19
 
20
20
  ## Requirements
21
21
 
22
- Versions are managed by the bundled fnm binary. Node installs live under fnm’s data directory (typically `~/.local/share/fnm`). For terminal `node` to follow the default version, use **Set up terminal** in the toolbar (writes init into your shell rc and links fnm under `~/.tinker/tinker-node-manager/bin`), then open a new terminal.
22
+ Versions are managed by the bundled fnm binary. Node installs live under fnm’s data directory (typically `~/.local/share/fnm`). For terminal `node` to follow the default version, use **Set up terminal** in the toolbar (links fnm under `~/.tinker/tinker-node-manager/bin` and writes init into your shell rc), then open a new terminal.
23
+
24
+ Shell targets: **zsh** → `~/.zshrc`, **bash** → `~/.bashrc`, **fish** → `~/.config/fish/config.fish`, **Windows** → PowerShell profile (`Documents/PowerShell/Microsoft.PowerShell_profile.ps1`, or Windows PowerShell’s profile if that is the one already present).
23
25
 
24
26
  ## Usage
25
27
 
@@ -1,13 +1,13 @@
1
- "use strict";const Zr=require("electron"),Qr=require("node:child_process"),Yr=require("node:util"),l=require("node:fs/promises"),jr=require("node:os"),v=require("node:path");function h(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var q={exports:{}},y={exports:{}},g={exports:{}},w={exports:{}},R={exports:{}},or;function Z(){return or||(or=1,(function(e,r){var n=Object.prototype.toString;r=function(t){return n.call(t)},e.exports=r})(R,R.exports)),R.exports}var ur;function _r(){return ur||(ur=1,(function(e,r){var n=Z();r=function(t){var i=n(t);return i==="[object Function]"||i==="[object GeneratorFunction]"||i==="[object AsyncFunction]"},e.exports=r})(w,w.exports)),w.exports}var A={exports:{}},ar;function re(){return ar||(ar=1,(function(e,r){r=function(n){var t=typeof n;return!!n&&(t==="function"||t==="object")},e.exports=r})(A,A.exports)),A.exports}var b={exports:{}},fr;function rr(){return fr||(fr=1,(function(e,r){var n=Z();Array.isArray?r=Array.isArray:r=function(t){return n(t)==="[object Array]"},e.exports=r})(b,b.exports)),b.exports}var S={exports:{}},O={exports:{}},cr;function er(){return cr||(cr=1,(function(e,r){r=function(n){return n===void 0},e.exports=r})(O,O.exports)),O.exports}var pr;function Br(){return pr||(pr=1,(function(e,r){var n=er();r=function(t,i,s){if(n(i))return t;switch(s??3){case 1:return function(o){return t.call(i,o)};case 3:return function(o,a,u){return t.call(i,o,a,u)};case 4:return function(o,a,u,f){return t.call(i,o,a,u,f)}}return function(){return t.apply(i,arguments)}},e.exports=r})(S,S.exports)),S.exports}var E={exports:{}},I={exports:{}},$={exports:{}},C={exports:{}},lr;function Dr(){return lr||(lr=1,(function(e,r){var n=Object.prototype.hasOwnProperty;r=function(t,i){return n.call(t,i)},e.exports=r})(C,C.exports)),C.exports}var vr;function Q(){return vr||(vr=1,(function(e,r){var n=Dr();Object.keys?r=Object.keys:r=function(t){var i=[];for(var s in t)n(t,s)&&i.push(s);return i},e.exports=r})($,$.exports)),$.exports}var P={exports:{}},k={exports:{}},F={exports:{}},L={exports:{}},xr;function ee(){return xr||(xr=1,(function(e,r){var n=Z();r=function(t){return n(t)==="[object Number]"},e.exports=r})(L,L.exports)),L.exports}var hr;function tr(){return hr||(hr=1,(function(e,r){var n=ee(),t=_r(),i=Math.pow(2,53)-1;r=function(s){if(!s)return!1;var o=s.length;return n(o)&&o>=0&&o<=i&&!t(s)},e.exports=r})(F,F.exports)),F.exports}var dr;function nr(){return dr||(dr=1,(function(e,r){var n=tr(),t=Q(),i=Br();r=function(s,o,a){o=i(o,a);var u,f;if(n(s))for(u=0,f=s.length;u<f;u++)o(s[u],u,s);else{var c=t(s);for(u=0,f=c.length;u<f;u++)o(s[c[u]],c[u],s)}return s},e.exports=r})(k,k.exports)),k.exports}var mr;function te(){return mr||(mr=1,(function(e,r){var n=er(),t=nr();r=function(i,s){return function(o){return t(arguments,function(a,u){if(u!==0){var f=i(a);t(f,function(c){(!s||n(o[c]))&&(o[c]=a[c])})}}),o}},e.exports=r})(P,P.exports)),P.exports}var qr;function ne(){return qr||(qr=1,(function(e,r){var n=Q(),t=te();r=t(n),e.exports=r})(I,I.exports)),I.exports}var V={exports:{}},yr;function ie(){return yr||(yr=1,(function(e,r){var n=Q();r=function(t,i){var s=n(i),o=s.length;if(t==null)return!o;t=Object(t);for(var a=0;a<o;a++){var u=s[a];if(i[u]!==t[u]||!(u in t))return!1}return!0},e.exports=r})(V,V.exports)),V.exports}var gr;function se(){return gr||(gr=1,(function(e,r){var n=ne(),t=ie();r=function(i){return i=n({},i),function(s){return t(s,i)}},e.exports=r})(E,E.exports)),E.exports}var M={exports:{}},wr;function oe(){return wr||(wr=1,(function(e,r){r=function(n){return n},e.exports=r})(M,M.exports)),M.exports}var N={exports:{}},T={exports:{}},z={exports:{}},Rr;function ue(){return Rr||(Rr=1,(function(e,r){var n=Dr(),t=rr();r=function(o,a){if(t(o))return o;if(a&&n(a,o))return[o];var u=[];return o.replace(i,function(f,c,p,m){u.push(p?m.replace(s,"$1"):c||f)}),u};var i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,s=/\\(\\)?/g;e.exports=r})(z,z.exports)),z.exports}var Ar;function ae(){return Ar||(Ar=1,(function(e,r){var n=er(),t=ue();r=function(i,s){s=t(s,i);var o;for(o=s.shift();!n(o);){if(i=i[o],i==null)return;o=s.shift()}return i},e.exports=r})(T,T.exports)),T.exports}var br;function fe(){return br||(br=1,(function(e,r){var n=rr(),t=ae();r=function(s){return n(s)?function(o){return t(o,s)}:i(s)};function i(s){return function(o){return o?.[s]}}e.exports=r})(N,N.exports)),N.exports}var Sr;function Gr(){return Sr||(Sr=1,(function(e,r){var n=_r(),t=re(),i=rr(),s=Br(),o=se(),a=oe(),u=fe();r=function(f,c,p){return f==null?a:n(f)?s(f,c,p):t(f)&&!i(f)?o(f):u(f)},e.exports=r})(g,g.exports)),g.exports}var Or;function Ur(){return Or||(Or=1,(function(e,r){var n=Gr(),t=nr();r=function(i,s,o){var a=[];return s=n(s,o),t(i,function(u,f,c){s(u,f,c)&&a.push(u)}),a},e.exports=r})(y,y.exports)),y.exports}var Er;function ce(){return Er||(Er=1,(function(e,r){var n=Ur();r=function(t){return n(t,function(i){return!!i})},e.exports=r})(q,q.exports)),q.exports}var pe=ce();const le=h(pe);var j={exports:{}},_={exports:{}},Ir;function ve(){return Ir||(Ir=1,(function(e,r){r=function(n,t,i){return Array.prototype.indexOf.call(n,t,i)},e.exports=r})(_,_.exports)),_.exports}var B={exports:{}},$r;function xe(){return $r||($r=1,(function(e,r){var n=Z();r=function(t){return n(t)==="[object String]"},e.exports=r})(B,B.exports)),B.exports}var D={exports:{}},Cr;function he(){return Cr||(Cr=1,(function(e,r){var n=nr();r=function(t){var i=[];return n(t,function(s){i.push(s)}),i},e.exports=r})(D,D.exports)),D.exports}var Pr;function de(){return Pr||(Pr=1,(function(e,r){var n=ve(),t=xe(),i=tr(),s=he();r=function(o,a){return t(o)?o.indexOf(a)>-1:(i(o)||(o=s(o)),n(o,a)>=0)},e.exports=r})(j,j.exports)),j.exports}var me=de();const K=h(me);var qe=Ur();const Wr=h(qe);var G={exports:{}},kr;function ye(){return kr||(kr=1,(function(e,r){var n=Gr(),t=Q(),i=tr();r=function(s,o,a){o=n(o,a);for(var u=!i(s)&&t(s),f=(u||s).length,c=Array(f),p=0;p<f;p++){var m=u?u[p]:p;c[p]=o(s[m],m,s)}return c},e.exports=r})(G,G.exports)),G.exports}var ge=ye();const ir=h(ge);var U={exports:{}},Fr;function we(){return Fr||(Fr=1,(function(e,r){var n=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;r=function(t){return t.replace(n,"")},e.exports=r})(U,U.exports)),U.exports}var Re=we();const sr=h(Re);var W={exports:{}},H={exports:{}},Lr;function Ae(){return Lr||(Lr=1,(function(e,r){var n=/^\s+/;r=function(t,i){if(i==null)return t.trimLeft?t.trimLeft():t.replace(n,"");for(var s=0,o=t.length,a=i.length,u=!0,f,c;u&&s<o;)for(u=!1,f=-1,c=t.charAt(s);++f<a;)if(c===i[f]){u=!0,s++;break}return s>=o?"":t.substr(s,o)},e.exports=r})(H,H.exports)),H.exports}var X={exports:{}},Vr;function Hr(){return Vr||(Vr=1,(function(e,r){r=function(n,t){if(t==null){if(n.trimRight)return n.trimRight();t=` \r
2
- \f\v`}for(var i=n.length-1,s=t.length,o=!0,a,u;o&&i>=0;)for(o=!1,a=-1,u=n.charAt(i);++a<s;)if(u===t[a]){o=!0,i--;break}return i>=0?n.substring(0,i+1):""},e.exports=r})(X,X.exports)),X.exports}var Mr;function be(){return Mr||(Mr=1,(function(e,r){var n=Ae(),t=Hr();r=function(i,s){return s==null&&i.trim?i.trim():n(t(i,s),s)},e.exports=r})(W,W.exports)),W.exports}var Se=be();const x=h(Se),Oe=Yr.promisify(Qr.execFile),Nr=require("fnm-static");function Xr(){if(!Nr)throw new Error("fnm binary not found for this platform");return Nr}async function d(e,r){const n=Xr();try{const{stdout:t,stderr:i}=await Oe(n,e,{encoding:"utf8",maxBuffer:20971520,timeout:r?.timeout??0,env:process.env});return{stdout:t||"",stderr:i||""}}catch(t){const i=t,s=x(sr(i.stderr||i.stdout||i.message||""));throw new Error(s||"fnm command failed")}}function Ee(e){const r=x(sr(e).replace(/^\*\s+/,""));if(!r)return null;const n=r.match(/^(\S+)(?:\s+(.*))?$/);if(!n)return null;const t=n[1],i=n[2]?le(ir(n[2].split(","),s=>x(s))):[];return{id:t,version:t,aliases:i,isDefault:K(i,"default"),isSystem:t==="system"}}async function Ie(){const{stdout:e}=await d(["list","--log-level","quiet"]);return Wr(ir(e.split(`
3
- `),r=>Ee(r)),r=>r!==null)}async function $e(e){const r=x(e);if(!r)throw new Error("Version is required");const n=["install","--progress","never","--log-level","info"];r==="lts"?n.push("--lts"):r==="latest"?n.push("--latest"):n.push(r),await d(n,{timeout:600*1e3})}async function Ce(e){const r=x(e);if(!r)throw new Error("Version is required");if(r==="system")throw new Error("Cannot uninstall system Node");await d(["uninstall",r,"--log-level","info"])}async function Pe(e){const r=x(e);if(!r)throw new Error("Version is required");if(r==="system")throw new Error("Cannot set system as default via fnm");await d(["default",r,"--log-level","info"])}function ke(e){const r=x(sr(e));if(!r)return null;const n=r.match(/^(\S+)(?:\s+\(([^)]+)\))?$/);if(!n)return null;const t=n[1];return{id:t,version:t,lts:n[2]?x(n[2]):null}}async function Fe(e){const r=["list-remote","--sort","desc","--log-level","quiet"];e?.ltsOnly&&r.splice(1,0,"--lts");const{stdout:n}=await d(r);return Wr(ir(n.split(`
4
- `),t=>ke(t)),t=>t!==null)}var J={exports:{}},Tr;function Le(){return Tr||(Tr=1,(function(e,r){r=function(n,t){var i=n.length-t.length;return i>=0&&n.indexOf(t,i)===i},e.exports=r})(J,J.exports)),J.exports}var Ve=Le();const Me=h(Ve);var Ne=Hr();const Te=h(Ne),Jr="# >>> tinker-node-manager >>>",Y="# <<< tinker-node-manager <<<",zr=v.join(jr.homedir(),".tinker","tinker-node-manager","bin");function ze(e){const r=v.basename(e).toLowerCase();return K(r,"zsh")?"zsh":K(r,"bash")?"bash":K(r,"fish")?"fish":r||"sh"}function je(e,r){return e==="zsh"?v.join(r,".zshrc"):e==="fish"?v.join(r,".config","fish","config.fish"):e==="bash"?v.join(r,".bashrc"):v.join(r,".profile")}function _e(e,r){const n=JSON.stringify(r),t=e==="fish"?`${n} env --shell fish | source`:`eval "$(${n} env)"`;return`${Jr}
1
+ "use strict";const ue=require("electron"),ae=require("node:child_process"),fe=require("node:util"),pr=require("node:fs"),x=require("node:fs/promises"),Yr=require("node:os"),p=require("node:path");function v(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var y={exports:{}},g={exports:{}},R={exports:{}},S={exports:{}},O={exports:{}},lr;function w(){return lr||(lr=1,(function(e,r){var t=Object.prototype.toString;r=function(n){return t.call(n)},e.exports=r})(O,O.exports)),O.exports}var vr;function Kr(){return vr||(vr=1,(function(e,r){var t=w();r=function(n){var i=t(n);return i==="[object Function]"||i==="[object GeneratorFunction]"||i==="[object AsyncFunction]"},e.exports=r})(S,S.exports)),S.exports}var b={exports:{}},xr;function ce(){return xr||(xr=1,(function(e,r){r=function(t){var n=typeof t;return!!t&&(n==="function"||n==="object")},e.exports=r})(b,b.exports)),b.exports}var A={exports:{}},hr;function sr(){return hr||(hr=1,(function(e,r){var t=w();Array.isArray?r=Array.isArray:r=function(n){return t(n)==="[object Array]"},e.exports=r})(A,A.exports)),A.exports}var E={exports:{}},I={exports:{}},dr;function or(){return dr||(dr=1,(function(e,r){r=function(t){return t===void 0},e.exports=r})(I,I.exports)),I.exports}var wr;function Zr(){return wr||(wr=1,(function(e,r){var t=or();r=function(n,i,s){if(t(i))return n;switch(s??3){case 1:return function(o){return n.call(i,o)};case 3:return function(o,a,u){return n.call(i,o,a,u)};case 4:return function(o,a,u,f){return n.call(i,o,a,u,f)}}return function(){return n.apply(i,arguments)}},e.exports=r})(E,E.exports)),E.exports}var P={exports:{}},$={exports:{}},C={exports:{}},k={exports:{}},mr;function Qr(){return mr||(mr=1,(function(e,r){var t=Object.prototype.hasOwnProperty;r=function(n,i){return t.call(n,i)},e.exports=r})(k,k.exports)),k.exports}var qr;function tr(){return qr||(qr=1,(function(e,r){var t=Qr();Object.keys?r=Object.keys:r=function(n){var i=[];for(var s in n)t(n,s)&&i.push(s);return i},e.exports=r})(C,C.exports)),C.exports}var F={exports:{}},L={exports:{}},j={exports:{}},N={exports:{}},yr;function pe(){return yr||(yr=1,(function(e,r){var t=w();r=function(n){return t(n)==="[object Number]"},e.exports=r})(N,N.exports)),N.exports}var gr;function ur(){return gr||(gr=1,(function(e,r){var t=pe(),n=Kr(),i=Math.pow(2,53)-1;r=function(s){if(!s)return!1;var o=s.length;return t(o)&&o>=0&&o<=i&&!n(s)},e.exports=r})(j,j.exports)),j.exports}var Rr;function ar(){return Rr||(Rr=1,(function(e,r){var t=ur(),n=tr(),i=Zr();r=function(s,o,a){o=i(o,a);var u,f;if(t(s))for(u=0,f=s.length;u<f;u++)o(s[u],u,s);else{var c=n(s);for(u=0,f=c.length;u<f;u++)o(s[c[u]],c[u],s)}return s},e.exports=r})(L,L.exports)),L.exports}var Sr;function le(){return Sr||(Sr=1,(function(e,r){var t=or(),n=ar();r=function(i,s){return function(o){return n(arguments,function(a,u){if(u!==0){var f=i(a);n(f,function(c){(!s||t(o[c]))&&(o[c]=a[c])})}}),o}},e.exports=r})(F,F.exports)),F.exports}var Or;function ve(){return Or||(Or=1,(function(e,r){var t=tr(),n=le();r=n(t),e.exports=r})($,$.exports)),$.exports}var V={exports:{}},br;function xe(){return br||(br=1,(function(e,r){var t=tr();r=function(n,i){var s=t(i),o=s.length;if(n==null)return!o;n=Object(n);for(var a=0;a<o;a++){var u=s[a];if(i[u]!==n[u]||!(u in n))return!1}return!0},e.exports=r})(V,V.exports)),V.exports}var Ar;function he(){return Ar||(Ar=1,(function(e,r){var t=ve(),n=xe();r=function(i){return i=t({},i),function(s){return n(s,i)}},e.exports=r})(P,P.exports)),P.exports}var M={exports:{}},Er;function de(){return Er||(Er=1,(function(e,r){r=function(t){return t},e.exports=r})(M,M.exports)),M.exports}var T={exports:{}},W={exports:{}},z={exports:{}},Ir;function we(){return Ir||(Ir=1,(function(e,r){var t=Qr(),n=sr();r=function(o,a){if(n(o))return o;if(a&&t(a,o))return[o];var u=[];return o.replace(i,function(f,c,l,q){u.push(l?q.replace(s,"$1"):c||f)}),u};var i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,s=/\\(\\)?/g;e.exports=r})(z,z.exports)),z.exports}var Pr;function me(){return Pr||(Pr=1,(function(e,r){var t=or(),n=we();r=function(i,s){s=n(s,i);var o;for(o=s.shift();!t(o);){if(i=i[o],i==null)return;o=s.shift()}return i},e.exports=r})(W,W.exports)),W.exports}var $r;function qe(){return $r||($r=1,(function(e,r){var t=sr(),n=me();r=function(s){return t(s)?function(o){return n(o,s)}:i(s)};function i(s){return function(o){return o?.[s]}}e.exports=r})(T,T.exports)),T.exports}var Cr;function re(){return Cr||(Cr=1,(function(e,r){var t=Kr(),n=ce(),i=sr(),s=Zr(),o=he(),a=de(),u=qe();r=function(f,c,l){return f==null?a:t(f)?s(f,c,l):n(f)&&!i(f)?o(f):u(f)},e.exports=r})(R,R.exports)),R.exports}var kr;function ee(){return kr||(kr=1,(function(e,r){var t=re(),n=ar();r=function(i,s,o){var a=[];return s=t(s,o),n(i,function(u,f,c){s(u,f,c)&&a.push(u)}),a},e.exports=r})(g,g.exports)),g.exports}var Fr;function ye(){return Fr||(Fr=1,(function(e,r){var t=ee();r=function(n){return t(n,function(i){return!!i})},e.exports=r})(y,y.exports)),y.exports}var ge=ye();const Re=v(ge);var _={exports:{}},D={exports:{}},Lr;function Se(){return Lr||(Lr=1,(function(e,r){r=function(t,n,i){return Array.prototype.indexOf.call(t,n,i)},e.exports=r})(D,D.exports)),D.exports}var B={exports:{}},jr;function Oe(){return jr||(jr=1,(function(e,r){var t=w();r=function(n){return t(n)==="[object String]"},e.exports=r})(B,B.exports)),B.exports}var G={exports:{}},Nr;function be(){return Nr||(Nr=1,(function(e,r){var t=ar();r=function(n){var i=[];return t(n,function(s){i.push(s)}),i},e.exports=r})(G,G.exports)),G.exports}var Vr;function Ae(){return Vr||(Vr=1,(function(e,r){var t=Se(),n=Oe(),i=ur(),s=be();r=function(o,a){return n(o)?o.indexOf(a)>-1:(i(o)||(o=s(o)),t(o,a)>=0)},e.exports=r})(_,_.exports)),_.exports}var Ee=Ae();const d=v(Ee);var Ie=ee();const te=v(Ie);var U={exports:{}},Mr;function Pe(){return Mr||(Mr=1,(function(e,r){var t=re(),n=tr(),i=ur();r=function(s,o,a){o=t(o,a);for(var u=!i(s)&&n(s),f=(u||s).length,c=Array(f),l=0;l<f;l++){var q=u?u[l]:l;c[l]=o(s[q],q,s)}return c},e.exports=r})(U,U.exports)),U.exports}var $e=Pe();const fr=v($e);var H={exports:{}},Tr;function Ce(){return Tr||(Tr=1,(function(e,r){var t=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;r=function(n){return n.replace(t,"")},e.exports=r})(H,H.exports)),H.exports}var ke=Ce();const cr=v(ke);var J={exports:{}},X={exports:{}},Wr;function Fe(){return Wr||(Wr=1,(function(e,r){var t=/^\s+/;r=function(n,i){if(i==null)return n.trimLeft?n.trimLeft():n.replace(t,"");for(var s=0,o=n.length,a=i.length,u=!0,f,c;u&&s<o;)for(u=!1,f=-1,c=n.charAt(s);++f<a;)if(c===i[f]){u=!0,s++;break}return s>=o?"":n.substr(s,o)},e.exports=r})(X,X.exports)),X.exports}var Y={exports:{}},zr;function ne(){return zr||(zr=1,(function(e,r){r=function(t,n){if(n==null){if(t.trimRight)return t.trimRight();n=` \r
2
+ \f\v`}for(var i=t.length-1,s=n.length,o=!0,a,u;o&&i>=0;)for(o=!1,a=-1,u=t.charAt(i);++a<s;)if(u===n[a]){o=!0,i--;break}return i>=0?t.substring(0,i+1):""},e.exports=r})(Y,Y.exports)),Y.exports}var _r;function Le(){return _r||(_r=1,(function(e,r){var t=Fe(),n=ne();r=function(i,s){return s==null&&i.trim?i.trim():t(n(i,s),s)},e.exports=r})(J,J.exports)),J.exports}var je=Le();const h=v(je),Ne=fe.promisify(ae.execFile),Dr=require("fnm-static");function ie(){if(!Dr)throw new Error("fnm binary not found for this platform");return Dr}async function m(e,r){const t=ie();try{const{stdout:n,stderr:i}=await Ne(t,e,{encoding:"utf8",maxBuffer:20971520,timeout:r?.timeout??0,env:process.env});return{stdout:n||"",stderr:i||""}}catch(n){const i=n,s=h(cr(i.stderr||i.stdout||i.message||""));throw new Error(s||"fnm command failed")}}function Ve(e){const r=h(cr(e).replace(/^\*\s+/,""));if(!r)return null;const t=r.match(/^(\S+)(?:\s+(.*))?$/);if(!t)return null;const n=t[1],i=t[2]?Re(fr(t[2].split(","),s=>h(s))):[];return{id:n,version:n,aliases:i,isDefault:d(i,"default"),isSystem:n==="system"}}async function Me(){const{stdout:e}=await m(["list","--log-level","quiet"]);return te(fr(e.split(`
3
+ `),r=>Ve(r)),r=>r!==null)}async function Te(e){const r=h(e);if(!r)throw new Error("Version is required");const t=["install","--progress","never","--log-level","info"];r==="lts"?t.push("--lts"):r==="latest"?t.push("--latest"):t.push(r),await m(t,{timeout:600*1e3})}async function We(e){const r=h(e);if(!r)throw new Error("Version is required");if(r==="system")throw new Error("Cannot uninstall system Node");await m(["uninstall",r,"--log-level","info"])}async function ze(e){const r=h(e);if(!r)throw new Error("Version is required");if(r==="system")throw new Error("Cannot set system as default via fnm");await m(["default",r,"--log-level","info"])}function _e(e){const r=h(cr(e));if(!r)return null;const t=r.match(/^(\S+)(?:\s+\(([^)]+)\))?$/);if(!t)return null;const n=t[1];return{id:n,version:n,lts:t[2]?h(t[2]):null}}async function De(e){const r=["list-remote","--sort","desc","--log-level","quiet"];e?.ltsOnly&&r.splice(1,0,"--lts");const{stdout:t}=await m(r);return te(fr(t.split(`
4
+ `),n=>_e(n)),n=>n!==null)}var K={exports:{}},Br;function Be(){return Br||(Br=1,(function(e,r){r=function(t,n){var i=t.length-n.length;return i>=0&&t.indexOf(n,i)===i},e.exports=r})(K,K.exports)),K.exports}var Ge=Be();const Ue=v(Ge);var Z={exports:{}},Q={exports:{}},rr={exports:{}},Gr;function He(){return Gr||(Gr=1,(function(e,r){r=typeof window=="object"&&typeof document=="object"&&document.nodeType===9,e.exports=r})(rr,rr.exports)),rr.exports}var er={exports:{}},Ur;function Je(){return Ur||(Ur=1,(function(e,r){var t=w();r=typeof process<"u"&&t(process)==="[object process]",e.exports=r})(er,er.exports)),er.exports}var Hr;function Xe(){return Hr||(Hr=1,(function(e,r){var t=He(),n=Je();r=function(i){!i&&t&&(i=navigator.userAgent);function s(f){return i.indexOf(f)>-1}if(i){if(i=i.toLowerCase(),s("windows phone"))return"windows phone";if(s("win"))return"windows";if(s("android"))return"android";if(s("ipad")||s("iphone")||s("ipod"))return"ios";if(s("mac"))return"os x";if(s("linux"))return"linux"}else if(n){var o=process,a=o.platform,u=o.env;if(a==="win32"||u.OSTYPE==="cygwin"||u.OSTYPE==="msys")return"windows";if(a==="darwin")return"os x";if(a==="linux")return"linux"}return"unknown"},e.exports=r})(Q,Q.exports)),Q.exports}var Jr;function Ye(){return Jr||(Jr=1,(function(e,r){var t=Xe();r=t()==="windows",e.exports=r})(Z,Z.exports)),Z.exports}var Ke=Ye();const nr=v(Ke);var Ze=ne();const Qe=v(Ze),se="# >>> tinker-node-manager >>>",ir="# <<< tinker-node-manager <<<",Xr=p.join(Yr.homedir(),".tinker","tinker-node-manager","bin");function rt(e){const r=p.basename(e).toLowerCase();return d(r,"zsh")?"zsh":d(r,"bash")?"bash":d(r,"fish")?"fish":d(r,"pwsh")||d(r,"powershell")?"powershell":r||"sh"}function et(){const e=process.env.SHELL||"",r=rt(e);return nr?r==="bash"||r==="zsh"||r==="fish"?r:"powershell":e?r:"zsh"}function tt(e){const r=p.join(e,"Documents"),t=p.join(r,"PowerShell","Microsoft.PowerShell_profile.ps1"),n=p.join(r,"WindowsPowerShell","Microsoft.PowerShell_profile.ps1");return pr.existsSync(n)&&!pr.existsSync(t)?n:t}function nt(e,r){return e==="powershell"?tt(r):e==="zsh"?p.join(r,".zshrc"):e==="fish"?p.join(r,".config","fish","config.fish"):e==="bash"?p.join(r,".bashrc"):p.join(r,".profile")}function it(e){return`'${e.replace(/'/g,"''")}'`}function st(e,r){let t;return e==="powershell"?t=`(& ${it(r)} env --shell powershell) | Out-String | Invoke-Expression`:e==="fish"?t=`${JSON.stringify(r)} env --shell fish | source`:t=`eval "$(${JSON.stringify(r)} env)"`,`${se}
5
5
  ${t}
6
- ${Y}`}function Be(e,r){const n=e.indexOf(Jr),t=e.indexOf(Y);if(n!==-1&&t!==-1&&t>n){const s=e.slice(0,n),o=e.slice(t+Y.length).replace(/^\n/,""),a=`${s}${r}
7
- ${o}`;return Me(a,`
8
- `)?a:`${a}
9
- `}const i=Te(e);return i?`${i}
6
+ ${ir}`}function ot(e,r){const t=e.indexOf(se),n=e.indexOf(ir);let i;if(t!==-1&&n!==-1&&n>t){const s=e.slice(0,t),o=e.slice(n+ir.length).replace(/^\n/,"");i=`${s}${r}
7
+ ${o}`}else{const s=Qe(e);i=s?`${s}
10
8
 
11
9
  ${r}
12
10
  `:`${r}
13
- `}async function De(e){await l.mkdir(zr,{recursive:!0});const r=v.join(zr,process.platform==="win32"?"fnm.exe":"fnm");try{await l.unlink(r)}catch{}try{await l.symlink(e,r)}catch{await l.copyFile(e,r),await l.chmod(r,493)}return r}function Kr(){const e=jr.homedir(),r=ze(process.env.SHELL||"/bin/zsh");return{shell:r,rcPath:je(r,e)}}async function Ge(){const e=Xr(),r=Kr(),n=await De(e),t=_e(r.shell,n);r.shell==="fish"&&await l.mkdir(v.dirname(r.rcPath),{recursive:!0});let i="";try{i=await l.readFile(r.rcPath,"utf8")}catch{i=""}return await l.writeFile(r.rcPath,Be(i,t),"utf8"),{...r,fnmPath:n}}const Ue={listVersions:()=>Ie(),listRemoteVersions:e=>Fe(e),installVersion:e=>$e(e),uninstallVersion:e=>Ce(e),setDefaultVersion:e=>Pe(e),getShellSetupPreview:()=>Kr(),setupShellEnv:()=>Ge()};Zr.contextBridge.exposeInMainWorld("nodeManager",Ue);
11
+ `}return Ue(i,`
12
+ `)?i:`${i}
13
+ `}async function ut(e){await x.mkdir(Xr,{recursive:!0});const r=p.join(Xr,nr?"fnm.exe":"fnm");try{await x.unlink(r)}catch{}try{await x.symlink(e,r)}catch{await x.copyFile(e,r),nr||await x.chmod(r,493)}return r}function oe(){const e=Yr.homedir(),r=et();return{shell:r,rcPath:nt(r,e)}}async function at(){const e=ie(),r=oe(),t=await ut(e),n=st(r.shell,t);await x.mkdir(p.dirname(r.rcPath),{recursive:!0});let i="";try{i=await x.readFile(r.rcPath,"utf8")}catch{i=""}return await x.writeFile(r.rcPath,ot(i,n),"utf8"),{...r,fnmPath:t}}const ft={listVersions:()=>Me(),listRemoteVersions:e=>De(e),installVersion:e=>Te(e),uninstallVersion:e=>We(e),setDefaultVersion:e=>ze(e),getShellSetupPreview:()=>oe(),setupShellEnv:()=>at()};ue.contextBridge.exposeInMainWorld("nodeManager",ft);