launch-ide
Advanced tools
+1
-1
@@ -1,1 +0,1 @@ | ||
| "use strict";var ee=Object.defineProperty,te=Object.defineProperties;var ne=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable;var R=(t,e,n)=>e in t?ee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,v=(t,e)=>{for(var n in e||(e={}))oe.call(e,n)&&R(t,n,e[n]);if(L)for(var n of L(e))re.call(e,n)&&R(t,n,e[n]);return t},B=(t,e)=>te(t,ne(e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("fs"),c=require("path"),I=require("child_process"),W=require("os"),C=require("chalk"),se=require("dotenv"),V={kiro:["/Kiro.app/Contents/MacOS/Electron","/Kiro.app/Contents/MacOS/Kiro"],cursor:["/Cursor.app/Contents/MacOS/Cursor"],comate:["/Comate.app/Contents/MacOS/Electron","/Comate.app/Contents/MacOS/Comate"],qoder:["/Qoder.app/Contents/MacOS/Electron","/Qoder CN.app/Contents/MacOS/Electron","/Qoder.app/Contents/MacOS/Qoder","/Qoder CN.app/Contents/MacOS/Qoder"],windsurf:["/Windsurf.app/Contents/MacOS/Electron","/Windsurf.app/Contents/MacOS/Windsurf"],devin:["Devin.app/Contents/MacOS/Devin","Devin.app/Contents/MacOS/Electron"],trae:["/Trae.app/Contents/MacOS/Electron","/Trae CN.app/Contents/MacOS/Electron","/Trae.app/Contents/MacOS/Trae","/Trae CN.app/Contents/MacOS/Trae"],codebuddy:["/Applications/CodeBuddy.app/Contents/MacOS/Electron","/Applications/CodeBuddy CN.app/Contents/MacOS/Electron","/Applications/CodeBuddy.app/Contents/MacOS/CodeBuddy","/Applications/CodeBuddy CN.app/Contents/MacOS/CodeBuddy"],antigravity:["/Antigravity.app/Contents/MacOS/Electron","/Antigravity.app/Contents/MacOS/Antigravity"],code:["/Visual Studio Code.app/Contents/MacOS/Electron","/Visual Studio Code.app/Contents/MacOS/Code"],"code-insiders":["/Visual Studio Code - Insiders.app/Contents/MacOS/Electron"],webstorm:["/WebStorm.app/Contents/MacOS/webstorm"],atom:["/Atom.app/Contents/MacOS/Atom","/Atom Beta.app/Contents/MacOS/Atom Beta"],hbuilder:["/HBuilderX.app/Contents/MacOS/HBuilderX"],phpstorm:["/PhpStorm.app/Contents/MacOS/phpstorm"],pycharm:["/PyCharm.app/Contents/MacOS/pycharm"],idea:["/IntelliJ IDEA.app/Contents/MacOS/idea"],codium:["/VSCodium.app/Contents/MacOS/Electron"],goland:["/GoLand.app/Contents/MacOS/goland"],colin:["/CLion.app/Contents/MacOS/clion"],appcode:["/AppCode.app/Contents/MacOS/appcode"],"atom-beta":["/Atom Beta.app/Contents/MacOS/Atom Beta"],brackets:["/Brackets.app/Contents/MacOS/Brackets"],rider:["/Rider.app/Contents/MacOS/rider"],rubymine:["/RubyMine.app/Contents/MacOS/rubymine"],sublime:["/Sublime Text.app/Contents/MacOS/sublime_text"],zed:["/Zed.app/Contents/MacOS/zed","/Zed.app/Contents/MacOS/cli"]},q={};for(let t of Object.values(V))for(let e of t)q[e]=e;const ae=B(v({},q),{"/Sublime Text.app/Contents/MacOS/Sublime Text":"/Sublime Text.app/Contents/SharedSupport/bin/subl","/Sublime Text.app/Contents/MacOS/sublime_text":"/Sublime Text.app/Contents/SharedSupport/bin/subl","/Sublime Text 2.app/Contents/MacOS/Sublime Text 2":"/Sublime Text 2.app/Contents/SharedSupport/bin/subl","/Sublime Text Dev.app/Contents/MacOS/Sublime Text":"/Sublime Text Dev.app/Contents/SharedSupport/bin/subl","/MacVim.app/Contents/MacOS/MacVim":"mvim","/Zed.app/Contents/MacOS/zed":"/Zed.app/Contents/MacOS/cli"}),F={kiro:"kiro",cursor:"cursor",comate:"comate",qoder:"qoder",devin:"devin",windsurf:"windsurf",trae:"trae",codebuddy:"codebuddy",antigravity:"antigravity",code:"vscode",codium:"vscodium",zed:"zed"},H={kiro:["kiro"],antigravity:["antigravity"],webstorm:["webstorm","webstorm.sh"],cursor:["cursor"],devin:["devin"],windsurf:["windsurf"],trae:["trae"],comate:["comate"],qoder:["qoder"],codebuddy:["codebuddy"],code:["code"],"code-insiders":["code-insiders"],atom:["atom"],hbuilder:["hbuilderx","hbuilderx.sh"],phpstorm:["phpstorm","phpstorm.sh"],pycharm:["pycharm","pycharm.sh"],idea:["idea","idea.sh"],codium:["vscodium"],goland:["goland"],brackets:["Brackets"],rider:["rider"],rubymine:["rubymine","rubymine.sh"],sublime:["sublime_text"],vim:["vim"],emacs:["emacs"],zed:["zed"]},Q={};Object.entries(H).forEach(([t,e])=>{for(let n of e)Q[n]=t});const ce=B(v({},Q),{vscodium:"vscodium",codium:"codium",hbuilderx:"hbuilderx","hbuilderx.sh":"hbuilderx",gvim:"gvim",sublime_text:"subl"}),X={kiro:["Kiro.exe"],antigravity:["Antigravity.exe"],webstorm:["webstorm.exe","webstorm64.exe"],cursor:["Cursor.exe"],windsurf:["Windsurf.exe"],devin:["Devin.exe"],trae:["Trae.exe","Trae CN.exe"],comate:["comate.exe"],qoder:["Qoder.exe","Qoder CN.exe"],codebuddy:["CodeBuddy.exe","CodeBuddy CN.exe"],code:["Code.exe"],"code-insiders":["Code - Insiders.exe"],atom:["atom.exe"],hbuilder:["HBuilderX.exe","HBuilder.exe","HBuilderX64.exe","HBuilder64.exe"],phpstorm:["phpstorm.exe","phpstorm64.exe"],pycharm:["pycharm.exe","pycharm64.exe"],idea:["idea.exe","idea64.exe"],codium:["VSCodium.exe"],goland:["goland.exe","goland64.exe"],colin:["clion.exe","clion64.exe"],brackets:["Brackets.exe"],rider:["rider.exe","rider64.exe"],rubymine:["rubymine.exe","rubymine64.exe"],sublime:["sublime_text.exe"],notepad:["notepad++.exe"],zed:["zed.exe"]},J={};for(let t of Object.values(X))for(let e of t)J[e]="";const ie=J,U={darwin:ae,linux:ce,win32:ie},A={darwin:V,linux:H,win32:X},m="{file}",f="{line}",x="{column}";function K(t,e,n,o){let r="".concat(t,":").concat(e,":").concat(n);if(typeof o=="string")r=o.replace(m,t).replace(f,e.toString()).replace(x,n.toString());else if(o instanceof Array)return o.map(s=>s.replace(m,t).replace(f,e.toString()).replace(x,n.toString()));return[r]}const le=["-g","-r","{file}:{line}:{column}"];function de(t){const{editorBasename:e,fileName:n,lineNumber:o,colNumber:r,workspace:s,openWindowParams:a,pathFormat:i}=t,w=pe({editorBasename:e,openWindowParams:a,workspace:s})||le;return K(n,o,r,i||w)}function ue(t){let e=c.basename(t).replace(/\.(exe|cmd|bat|sh)$/i,"");const n=process.platform,o=Object.keys(A[n]);for(let r=0;r<o.length;r++)if((A[n][o[r]]||[]).some(a=>t.toLowerCase().endsWith(a.toLowerCase()))){e=o[r];break}return e.toLowerCase()}function pe(t){const{editorBasename:e,openWindowParams:n,workspace:o}=t;switch(e){case"atom":case"atom beta":case"subl":case"sublime":case"sublime_text":case"wstorm":case"charm":return"".concat(m,":").concat(f,":").concat(x);case"notepad++":return["-n"+f,"-c"+x,m];case"vim":case"mvim":return["+call cursor(".concat(f,", ").concat(x,")"),m];case"joe":case"gvim":return["+"+f,m];case"emacs":case"emacsclient":return["+"+f+":"+x,m];case"rmate":case"mate":case"mine":return["--line",f,m];case"code":case"code-insiders":case"code - insiders":case"codium":case"cursor":case"windsurf":case"devin":case"trae":case"codebuddy":case"antigravity":case"comate":case"qoder":case"vscodium":case"hbuilderx":case"hbuilder":case"kiro":return[...o?[o]:[],"-g",...n?[n]:[],"".concat(m,":").concat(f,":").concat(x)];case"appcode":case"clion":case"clion64":case"idea":case"idea64":case"phpstorm":case"phpstorm64":case"pycharm":case"pycharm64":case"rubymine":case"rubymine64":case"webstorm":case"webstorm64":case"goland":case"goland64":case"rider":case"rider64":return[...o?[o]:[],"--line",f,"--column",x,m];case"zed":return[n==="-n"?"-n":"-a","".concat(m,":").concat(f,":").concat(x)]}return""}function Z(t){let e={};process.env&&(e=v({},process.env));let n="";if(t){const o=c.resolve(t,".env.local");b.existsSync(o)&&(n=o)}if(!n){const o=c.resolve(process.cwd(),".env.local");b.existsSync(o)&&(n=o)}if(n){const o=b.readFileSync(n,"utf-8"),r=se.parse(o||"");e=v(v({},r),e)}return e}function k(t,e){return Z(e)[t]||null}const me={darwin:"ps ax -o comm=",linux:"ps -eo comm --sort=comm",win32:'powershell -NoProfile -Command "Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }"'};function fe(t,e,n){let o=null;const r=k("CODE_EDITOR",e||"");if(r){const s=j(r);if(s)o=s;else return[r]}if(!o&&t){const s=j(t);s&&(o=s)}if(!o&&n){const s=he();if(s)return[s]}try{let s;const a=process.platform,i=process.platform==="win32",g=me[a],w=U[a];G(i);const N=I.execSync(g,{encoding:"utf-8"}),h=Object.keys(w),y=N.split(i?"\r\n":"\n").map(E=>E.trim());for(let E=0;E<h.length;E++){const l=h[E];let S="",M="";if(i){const u=y.find(P=>c.basename(P).toLowerCase()===l.toLowerCase());u&&(M=c.basename(u),S=Ce(u))}else if(a==="darwin"){const u=y.find(P=>P.toLowerCase().endsWith(l.toLowerCase()));if(u){const P=u.replace(l,""),_=w[l];M=l,_.includes("/")?S="".concat(P).concat(_):S=_}}else N.indexOf(l)!==-1&&(M=l,S=w[l]);if(M&&S){if(o!=null&&o.includes(M))return[S];s||(s=[S])}}if(s)return s}catch(s){}return process.env.VISUAL?[process.env.VISUAL]:process.env.EDITOR?[process.env.EDITOR]:[null]}const j=t=>{const e=process.platform;return A[e]&&A[e][t]||null};function Ce(t){if(c.basename(t).toLowerCase()==="zed.exe"){const e=c.join(c.dirname(t),"bin","zed.exe");if(b.existsSync(e))return e}return t}const G=t=>{if(t)try{I.execSync("chcp 65001")}catch(e){}};function he(){const t=process.platform,e=Object.keys(U[t]);try{return be(process.pid,t,e)}catch(n){return console.log(C.red("Error while getting editor by PID:"),n),null}}function be(t,e,n){let o=0;const r=50,s=0;for(;t&&t!==s&&o<r;){const a=Se(t,e);if(!a)break;const{command:i,parentPid:g}=a;if(ye(i,n))return i;t=g,o++}return null}function Se(t,e){switch(e){case"darwin":case"linux":return Oe(t);case"win32":return xe(t);default:return null}}function Oe(t){try{const n=I.execSync("ps -p ".concat(t," -o ppid=,comm="),{encoding:"utf8"}).trim().split("\n");return n.length?ge(n[0].trim()):null}catch(e){return null}}function xe(t){try{G(!0);const e='powershell -NoProfile -Command "Get-CimInstance -ClassName Win32_Process -Filter "ProcessId='.concat(t,'" | Select-Object ParentProcessId, ExecutablePath | ConvertTo-Csv -NoTypeInformation'),o=I.execSync(e,{encoding:"utf8"}).trim().split("\r\n").filter(a=>a.trim()).slice(1);if(o.length===0)return null;const[r,s]=o[0].split(",");return!s||!r?null:{command:s.slice(1,-1),parentPid:Number(r.slice(1,-1))}}catch(e){return null}}function ge(t){const e=t.match(/^(\d+)\s+(.+)$/);return e?{command:e[2],parentPid:parseInt(e[1])}:null}function ye(t,e){return e.some(n=>t.toLowerCase().endsWith(n.toLowerCase()))}const ve=262,D=new Map,we=new Set(["appcode","clion","clion64","idea","idea64","phpstorm","phpstorm64","pycharm","pycharm64","rubymine","rubymine64","webstorm","webstorm64","goland","goland64","rider","rider64"]);function Ee(t){return we.has(t)}function Me(t,e){if(e){const r=c.resolve(e);if(b.existsSync(r))return r}const n=[];let o=c.dirname(c.resolve(t));for(;;){n.push(o);const r=c.dirname(o);if(r===o)break;o=r}for(const r of[".idea",".git"]){const s=n.find(a=>b.existsSync(c.join(a,r)));if(s)return s}return c.dirname(c.resolve(t))}function Pe(t){const e=t.includes(c.sep)?[t]:(process.env.PATH||"").split(c.delimiter).filter(Boolean).map(n=>c.join(n,t));for(const n of e)try{if(b.existsSync(n))return b.realpathSync(n)}catch(o){}return null}function Ie(t){const e=c.dirname(t);return[c.resolve(e,"../Resources/product-info.json"),c.resolve(e,"../product-info.json")]}function Ne(t){const e=Number.parseInt(t.buildNumber||"",10);if(!Number.isNaN(e))return e>=ve;const n=/^(\d{4})\.(\d+)/.exec(t.version||"");if(!n)return!1;const o=Number(n[1]),r=Number(n[2]);return o>2026||o===2026&&r>=2}function _e(t){const e=D.get(t);if(e!==void 0)return e;const n=Pe(t);if(!n)return D.set(t,!1),!1;for(const o of Ie(n))try{const r=JSON.parse(b.readFileSync(o,"utf8")),s=Ne(r);return D.set(t,s),s}catch(r){}return D.set(t,!1),!1}function Te(t){switch(t){case"vim":case"emacs":case"nano":return!0}return!1}function Be(t){const e=k("CODE_INSPECTOR_FORMAT_PATH",t);if(e)try{return JSON.parse(e)}catch(n){return null}return null}function De(t,e){console.log(C.red("Could not open "+c.basename(t)+" in the editor.")),e&&(e[e.length-1]!=="."&&(e+="."),console.log(C.red("The editor process exited with an error: "+e))),console.log("To set up the editor integration, add something like "+C.cyan("CODE_EDITOR=code")+" to the "+C.green(".env.local")+" file in your project folder, or add "+C.green('editor: "code"')+" to CodeInspectorPlugin config, and then restart the development server. Learn more: "+C.green("https://goo.gl/MMTaZt"))}let O=null;function Ae(t){return t==="reuse"?"-r":t==="new"?"-n":""}function z(t,e){const n=B(v({},process.env),{NODE_OPTIONS:""});if(process.platform==="win32"){const o=a=>a.replace(/([&|<>,;=^])/g,"^$1"),r=a=>a.includes("^")?'^"'.concat(a,'^"'):a.includes(" ")?'"'.concat(a,'"'):a,s=[t,...e.map(o)].map(r).join(" ");return I.exec(s,{shell:!0,env:n})}return I.spawn(t,e,{stdio:"ignore",env:n})}function ke(t){let{file:e,line:n=1,column:o=1,editor:r,method:s,format:a,onError:i,rootDir:g,usePid:w,type:N="exec"}=t;if(!b.existsSync(e))return;let[h,...y]=fe(r,g,w);const E=y.filter(d=>d!==null);let l=null;const S=Be(g||"")||a;if(!h||h.toLowerCase()==="none"){typeof i=="function"?i(e,"Failed to recognize IDE automatically"):console.log("Failed to recognize IDE automatically, add something like "+C.cyan("CODE_EDITOR=code")+" to the "+C.green(".env.local")+" file in your project folder, or add "+C.green('editor: "code"')+" to CodeInspectorPlugin config, and then restart the development server. Learn more: "+C.green("https://goo.gl/MMTaZt"));return}const M=h,u=ue(h);if((N==="open"||N==="open-bg")&&process.platform==="darwin"&&F[u]){const d="".concat(F[u],"://file").concat(e,":").concat(n,":").concat(o),p=N==="open-bg"?["-g",d]:[d];O=I.spawn("open",p,{stdio:"ignore",env:B(v({},process.env),{NODE_OPTIONS:""})})}else{process.platform==="linux"&&e.startsWith("/mnt/")&&/Microsoft/i.test(W.release())&&(e=c.relative("",e));let p=_e(h)?Me(e,g):null;p&&process.platform==="linux"&&p.startsWith("/mnt/")&&/Microsoft/i.test(W.release())&&(p=c.relative("",p)),n?(Ee(u)&&(l=E.concat([e,"--line",String(n),"--column",String(o)])),y=y.concat(de({editorBasename:u,fileName:e,lineNumber:n,colNumber:o,workspace:p,openWindowParams:Ae(s),pathFormat:S}))):y.push(e),O&&Te(h)&&O.kill("SIGKILL"),O=z(h,y)}const P=d=>{typeof i=="function"?i(e,d):De(e,d)},_=d=>{let p=!1;const $=T=>{if(!p){if(p=!0,l){const Y=l;l=null,O=z(M,Y),_(O);return}P(T)}};d.on("exit",function(T){O===d&&(O=null),T?$("(code "+T+")"):p=!0}),d.on("error",function(T){$(T.message)})};_(O)}exports.formatOpenPath=K;exports.getEnvVariable=k;exports.getEnvVariables=Z;exports.launchIDE=ke; | ||
| "use strict";var ee=Object.defineProperty,te=Object.defineProperties;var ne=Object.getOwnPropertyDescriptors;var $=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable;var L=(t,e,n)=>e in t?ee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,v=(t,e)=>{for(var n in e||(e={}))oe.call(e,n)&&L(t,n,e[n]);if($)for(var n of $(e))re.call(e,n)&&L(t,n,e[n]);return t},B=(t,e)=>te(t,ne(e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("fs"),c=require("path"),w=require("child_process"),W=require("os"),C=require("chalk"),se=require("dotenv"),V={kiro:["/Kiro.app/Contents/MacOS/Electron","/Kiro.app/Contents/MacOS/Kiro"],cursor:["/Cursor.app/Contents/MacOS/Cursor"],comate:["/Comate.app/Contents/MacOS/Electron","/Comate.app/Contents/MacOS/Comate"],qoder:["/Qoder.app/Contents/MacOS/Electron","/Qoder CN.app/Contents/MacOS/Electron","/Qoder.app/Contents/MacOS/Qoder","/Qoder CN.app/Contents/MacOS/Qoder"],windsurf:["/Windsurf.app/Contents/MacOS/Electron","/Windsurf.app/Contents/MacOS/Windsurf"],devin:["Devin.app/Contents/MacOS/Devin","Devin.app/Contents/MacOS/Electron"],trae:["/Trae.app/Contents/MacOS/Electron","/Trae CN.app/Contents/MacOS/Electron","/Trae.app/Contents/MacOS/Trae","/Trae CN.app/Contents/MacOS/Trae"],codebuddy:["/Applications/CodeBuddy.app/Contents/MacOS/Electron","/Applications/CodeBuddy CN.app/Contents/MacOS/Electron","/Applications/CodeBuddy.app/Contents/MacOS/CodeBuddy","/Applications/CodeBuddy CN.app/Contents/MacOS/CodeBuddy"],antigravity:["/Antigravity.app/Contents/MacOS/Electron","/Antigravity.app/Contents/MacOS/Antigravity"],code:["/Visual Studio Code.app/Contents/MacOS/Electron","/Visual Studio Code.app/Contents/MacOS/Code"],"code-insiders":["/Visual Studio Code - Insiders.app/Contents/MacOS/Electron"],webstorm:["/WebStorm.app/Contents/MacOS/webstorm"],atom:["/Atom.app/Contents/MacOS/Atom","/Atom Beta.app/Contents/MacOS/Atom Beta"],hbuilder:["/HBuilderX.app/Contents/MacOS/HBuilderX"],phpstorm:["/PhpStorm.app/Contents/MacOS/phpstorm"],pycharm:["/PyCharm.app/Contents/MacOS/pycharm"],idea:["/IntelliJ IDEA.app/Contents/MacOS/idea"],codium:["/VSCodium.app/Contents/MacOS/Electron"],goland:["/GoLand.app/Contents/MacOS/goland"],colin:["/CLion.app/Contents/MacOS/clion"],appcode:["/AppCode.app/Contents/MacOS/appcode"],"atom-beta":["/Atom Beta.app/Contents/MacOS/Atom Beta"],brackets:["/Brackets.app/Contents/MacOS/Brackets"],rider:["/Rider.app/Contents/MacOS/rider"],rubymine:["/RubyMine.app/Contents/MacOS/rubymine"],sublime:["/Sublime Text.app/Contents/MacOS/sublime_text"],zed:["/Zed.app/Contents/MacOS/zed","/Zed.app/Contents/MacOS/cli"]},q={};for(let t of Object.values(V))for(let e of t)q[e]=e;const ae=B(v({},q),{"/Sublime Text.app/Contents/MacOS/Sublime Text":"/Sublime Text.app/Contents/SharedSupport/bin/subl","/Sublime Text.app/Contents/MacOS/sublime_text":"/Sublime Text.app/Contents/SharedSupport/bin/subl","/Sublime Text 2.app/Contents/MacOS/Sublime Text 2":"/Sublime Text 2.app/Contents/SharedSupport/bin/subl","/Sublime Text Dev.app/Contents/MacOS/Sublime Text":"/Sublime Text Dev.app/Contents/SharedSupport/bin/subl","/MacVim.app/Contents/MacOS/MacVim":"mvim","/Zed.app/Contents/MacOS/zed":"/Zed.app/Contents/MacOS/cli"}),j={kiro:"kiro",cursor:"cursor",comate:"comate",qoder:"qoder",devin:"devin",windsurf:"windsurf",trae:"trae",codebuddy:"codebuddy",antigravity:"antigravity",code:"vscode",codium:"vscodium",zed:"zed"},H={kiro:["kiro"],antigravity:["antigravity"],webstorm:["webstorm","webstorm.sh"],cursor:["cursor"],devin:["devin"],windsurf:["windsurf"],trae:["trae"],comate:["comate"],qoder:["qoder"],codebuddy:["codebuddy"],code:["code"],"code-insiders":["code-insiders"],atom:["atom"],hbuilder:["hbuilderx","hbuilderx.sh"],phpstorm:["phpstorm","phpstorm.sh"],pycharm:["pycharm","pycharm.sh"],idea:["idea","idea.sh"],codium:["vscodium"],goland:["goland"],brackets:["Brackets"],rider:["rider"],rubymine:["rubymine","rubymine.sh"],sublime:["sublime_text"],vim:["vim"],emacs:["emacs"],zed:["zed"]},Q={};Object.entries(H).forEach(([t,e])=>{for(let n of e)Q[n]=t});const ce=B(v({},Q),{vscodium:"vscodium",codium:"codium",hbuilderx:"hbuilderx","hbuilderx.sh":"hbuilderx",gvim:"gvim",sublime_text:"subl"}),X={kiro:["Kiro.exe"],antigravity:["Antigravity.exe"],webstorm:["webstorm.exe","webstorm64.exe"],cursor:["Cursor.exe"],windsurf:["Windsurf.exe"],devin:["Devin.exe"],trae:["Trae.exe","Trae CN.exe"],comate:["comate.exe"],qoder:["Qoder.exe","Qoder CN.exe"],codebuddy:["CodeBuddy.exe","CodeBuddy CN.exe"],code:["Code.exe"],"code-insiders":["Code - Insiders.exe"],atom:["atom.exe"],hbuilder:["HBuilderX.exe","HBuilder.exe","HBuilderX64.exe","HBuilder64.exe"],phpstorm:["phpstorm.exe","phpstorm64.exe"],pycharm:["pycharm.exe","pycharm64.exe"],idea:["idea.exe","idea64.exe"],codium:["VSCodium.exe"],goland:["goland.exe","goland64.exe"],colin:["clion.exe","clion64.exe"],brackets:["Brackets.exe"],rider:["rider.exe","rider64.exe"],rubymine:["rubymine.exe","rubymine64.exe"],sublime:["sublime_text.exe"],notepad:["notepad++.exe"],zed:["zed.exe"]},J={};for(let t of Object.values(X))for(let e of t)J[e]="";const ie=J,U={darwin:ae,linux:ce,win32:ie},A={darwin:V,linux:H,win32:X},m="{file}",f="{line}",g="{column}";function K(t,e,n,o){let s="".concat(t,":").concat(e,":").concat(n);if(typeof o=="string")s=o.replace(m,t).replace(f,e.toString()).replace(g,n.toString());else if(o instanceof Array)return o.map(r=>r.replace(m,t).replace(f,e.toString()).replace(g,n.toString()));return[s]}const le=["-g","-r","{file}:{line}:{column}"];function de(t){const{editorBasename:e,fileName:n,lineNumber:o,colNumber:s,workspace:r,openWindowParams:a,pathFormat:i}=t,E=pe({editorBasename:e,openWindowParams:a,workspace:r})||le;return K(n,o,s,i||E)}function ue(t){let e=c.basename(t).replace(/\.(exe|cmd|bat|sh)$/i,"");const n=process.platform,o=Object.keys(A[n]);for(let s=0;s<o.length;s++)if((A[n][o[s]]||[]).some(a=>t.toLowerCase().endsWith(a.toLowerCase()))){e=o[s];break}return e.toLowerCase()}function pe(t){const{editorBasename:e,openWindowParams:n,workspace:o}=t;switch(e){case"atom":case"atom beta":case"subl":case"sublime":case"sublime_text":case"wstorm":case"charm":return"".concat(m,":").concat(f,":").concat(g);case"notepad++":return["-n"+f,"-c"+g,m];case"vim":case"mvim":return["+call cursor(".concat(f,", ").concat(g,")"),m];case"joe":case"gvim":return["+"+f,m];case"emacs":case"emacsclient":return["+"+f+":"+g,m];case"rmate":case"mate":case"mine":return["--line",f,m];case"code":case"code-insiders":case"code - insiders":case"codium":case"cursor":case"windsurf":case"devin":case"trae":case"codebuddy":case"antigravity":case"comate":case"qoder":case"vscodium":case"hbuilderx":case"hbuilder":case"kiro":return[...o?[o]:[],"-g",...n?[n]:[],"".concat(m,":").concat(f,":").concat(g)];case"appcode":case"clion":case"clion64":case"idea":case"idea64":case"phpstorm":case"phpstorm64":case"pycharm":case"pycharm64":case"rubymine":case"rubymine64":case"webstorm":case"webstorm64":case"goland":case"goland64":case"rider":case"rider64":return[...o?[o]:[],"--line",f,"--column",g,m];case"zed":return[n==="-n"?"-n":"-a","".concat(m,":").concat(f,":").concat(g)]}return""}function Z(t){let e={};process.env&&(e=v({},process.env));let n="";if(t){const o=c.resolve(t,".env.local");b.existsSync(o)&&(n=o)}if(!n){const o=c.resolve(process.cwd(),".env.local");b.existsSync(o)&&(n=o)}if(n){const o=b.readFileSync(n,"utf-8"),s=se.parse(o||"");e=v(v({},s),e)}return e}function k(t,e){return Z(e)[t]||null}const me={darwin:"ps ax -o comm=",linux:"ps -eo comm --sort=comm",win32:'powershell -NoProfile -Command "Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }"'};function fe(t,e,n){let o=null;const s=k("CODE_EDITOR",e||"");if(s){const r=F(s);if(r)o=r;else return[s]}if(!o&&t){const r=F(t);r&&(o=r)}if(!o&&n){const r=he();if(r)return[r]}try{let r;const a=process.platform,i=process.platform==="win32",x=me[a],E=U[a];G(i);const N=w.execSync(x,{encoding:"utf-8"}),h=Object.keys(E),y=N.split(i?"\r\n":"\n").map(M=>M.trim());for(let M=0;M<h.length;M++){const l=h[M];let S="",P="";if(i){const u=y.find(I=>c.basename(I).toLowerCase()===l.toLowerCase());u&&(P=c.basename(u),S=Ce(u))}else if(a==="darwin"){const u=y.find(I=>I.toLowerCase().endsWith(l.toLowerCase()));if(u){const I=u.replace(l,""),_=E[l];P=l,_.includes("/")?S="".concat(I).concat(_):S=_}}else N.indexOf(l)!==-1&&(P=l,S=E[l]);if(P&&S){if(o!=null&&o.includes(P))return[S];r||(r=[S])}}if(r)return r}catch(r){}return process.env.VISUAL?[process.env.VISUAL]:process.env.EDITOR?[process.env.EDITOR]:[null]}const F=t=>{const e=process.platform;return A[e]&&A[e][t]||null};function Ce(t){if(c.basename(t).toLowerCase()==="zed.exe"){const e=c.join(c.dirname(t),"bin","zed.exe");if(b.existsSync(e))return e}return t}const G=t=>{if(t)try{w.execSync("chcp 65001")}catch(e){}};function he(){const t=process.platform,e=Object.keys(U[t]);try{return be(process.pid,t,e)}catch(n){return console.log(C.red("Error while getting editor by PID:"),n),null}}function be(t,e,n){let o=0;const s=50,r=0;for(;t&&t!==r&&o<s;){const a=Se(t,e);if(!a)break;const{command:i,parentPid:x}=a;if(ye(i,n))return i;t=x,o++}return null}function Se(t,e){switch(e){case"darwin":case"linux":return Oe(t);case"win32":return ge(t);default:return null}}function Oe(t){try{const n=w.execSync("ps -p ".concat(t," -o ppid=,comm="),{encoding:"utf8"}).trim().split("\n");return n.length?xe(n[0].trim()):null}catch(e){return null}}function ge(t){try{G(!0);const e='powershell -NoProfile -Command "Get-CimInstance -ClassName Win32_Process -Filter "ProcessId='.concat(t,'" | Select-Object ParentProcessId, ExecutablePath | ConvertTo-Csv -NoTypeInformation'),o=w.execSync(e,{encoding:"utf8"}).trim().split("\r\n").filter(a=>a.trim()).slice(1);if(o.length===0)return null;const[s,r]=o[0].split(",");return!r||!s?null:{command:r.slice(1,-1),parentPid:Number(s.slice(1,-1))}}catch(e){return null}}function xe(t){const e=t.match(/^(\d+)\s+(.+)$/);return e?{command:e[2],parentPid:parseInt(e[1])}:null}function ye(t,e){return e.some(n=>t.toLowerCase().endsWith(n.toLowerCase()))}const ve=262,D=new Map,we=new Set(["appcode","clion","clion64","idea","idea64","phpstorm","phpstorm64","pycharm","pycharm64","rubymine","rubymine64","webstorm","webstorm64","goland","goland64","rider","rider64"]);function Ee(t){return we.has(t)}function Me(){try{return w.execSync("git rev-parse --show-toplevel",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim()}catch(t){return""}}function Pe(t,e){if(e){const r=c.resolve(e);if(b.existsSync(r))return r}const n=Me();if(n)return n;const o=[];let s=c.dirname(c.resolve(t));for(;;){o.push(s);const r=c.dirname(s);if(r===s)break;s=r}for(const r of[".idea",".git"]){const a=o.find(i=>b.existsSync(c.join(i,r)));if(a)return a}return c.dirname(c.resolve(t))}function Ie(t){const e=t.includes(c.sep)?[t]:(process.env.PATH||"").split(c.delimiter).filter(Boolean).map(n=>c.join(n,t));for(const n of e)try{if(b.existsSync(n))return b.realpathSync(n)}catch(o){}return null}function Ne(t){const e=c.dirname(t);return[c.resolve(e,"../Resources/product-info.json"),c.resolve(e,"../product-info.json")]}function _e(t){const e=Number.parseInt(t.buildNumber||"",10);if(!Number.isNaN(e))return e>=ve;const n=/^(\d{4})\.(\d+)/.exec(t.version||"");if(!n)return!1;const o=Number(n[1]),s=Number(n[2]);return o>2026||o===2026&&s>=2}function Te(t){const e=D.get(t);if(e!==void 0)return e;const n=Ie(t);if(!n)return D.set(t,!1),!1;for(const o of Ne(n))try{const s=JSON.parse(b.readFileSync(o,"utf8")),r=_e(s);return D.set(t,r),r}catch(s){}return D.set(t,!1),!1}function Be(t){switch(t){case"vim":case"emacs":case"nano":return!0}return!1}function De(t){const e=k("CODE_INSPECTOR_FORMAT_PATH",t);if(e)try{return JSON.parse(e)}catch(n){return null}return null}function Ae(t,e){console.log(C.red("Could not open "+c.basename(t)+" in the editor.")),e&&(e[e.length-1]!=="."&&(e+="."),console.log(C.red("The editor process exited with an error: "+e))),console.log("To set up the editor integration, add something like "+C.cyan("CODE_EDITOR=code")+" to the "+C.green(".env.local")+" file in your project folder, or add "+C.green('editor: "code"')+" to CodeInspectorPlugin config, and then restart the development server. Learn more: "+C.green("https://goo.gl/MMTaZt"))}let O=null;function ke(t){return t==="reuse"?"-r":t==="new"?"-n":""}function z(t,e){const n=B(v({},process.env),{NODE_OPTIONS:""});if(process.platform==="win32"){const o=a=>a.replace(/([&|<>,;=^])/g,"^$1"),s=a=>a.includes("^")?'^"'.concat(a,'^"'):a.includes(" ")?'"'.concat(a,'"'):a,r=[t,...e.map(o)].map(s).join(" ");return w.exec(r,{shell:!0,env:n})}return w.spawn(t,e,{stdio:"ignore",env:n})}function Re(t){let{file:e,line:n=1,column:o=1,editor:s,method:r,format:a,onError:i,rootDir:x,usePid:E,type:N="exec"}=t;if(!b.existsSync(e))return;let[h,...y]=fe(s,x,E);const M=y.filter(d=>d!==null);let l=null;const S=De(x||"")||a;if(!h||h.toLowerCase()==="none"){typeof i=="function"?i(e,"Failed to recognize IDE automatically"):console.log("Failed to recognize IDE automatically, add something like "+C.cyan("CODE_EDITOR=code")+" to the "+C.green(".env.local")+" file in your project folder, or add "+C.green('editor: "code"')+" to CodeInspectorPlugin config, and then restart the development server. Learn more: "+C.green("https://goo.gl/MMTaZt"));return}const P=h,u=ue(h);if((N==="open"||N==="open-bg")&&process.platform==="darwin"&&j[u]){const d="".concat(j[u],"://file").concat(e,":").concat(n,":").concat(o),p=N==="open-bg"?["-g",d]:[d];O=w.spawn("open",p,{stdio:"ignore",env:B(v({},process.env),{NODE_OPTIONS:""})})}else{process.platform==="linux"&&e.startsWith("/mnt/")&&/Microsoft/i.test(W.release())&&(e=c.relative("",e));let p=Te(h)?Pe(e,x):null;p&&process.platform==="linux"&&p.startsWith("/mnt/")&&/Microsoft/i.test(W.release())&&(p=c.relative("",p)),n?(Ee(u)&&(l=M.concat([e,"--line",String(n),"--column",String(o)])),y=y.concat(de({editorBasename:u,fileName:e,lineNumber:n,colNumber:o,workspace:p,openWindowParams:ke(r),pathFormat:S}))):y.push(e),O&&Be(h)&&O.kill("SIGKILL"),O=z(h,y)}const I=d=>{typeof i=="function"?i(e,d):Ae(e,d)},_=d=>{let p=!1;const R=T=>{if(!p){if(p=!0,l){const Y=l;l=null,O=z(P,Y),_(O);return}I(T)}};d.on("exit",function(T){O===d&&(O=null),T?R("(code "+T+")"):p=!0}),d.on("error",function(T){R(T.message)})};_(O)}exports.formatOpenPath=K;exports.getEnvVariable=k;exports.getEnvVariables=Z;exports.launchIDE=Re; |
+167
-154
| var G = Object.defineProperty, Y = Object.defineProperties; | ||
| var ee = Object.getOwnPropertyDescriptors; | ||
| var $ = Object.getOwnPropertySymbols; | ||
| var R = Object.getOwnPropertySymbols; | ||
| var te = Object.prototype.hasOwnProperty, ne = Object.prototype.propertyIsEnumerable; | ||
| var L = (t, e, n) => e in t ? G(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, v = (t, e) => { | ||
| var $ = (t, e, n) => e in t ? G(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, v = (t, e) => { | ||
| for (var n in e || (e = {})) | ||
| te.call(e, n) && L(t, n, e[n]); | ||
| if ($) | ||
| for (var n of $(e)) | ||
| ne.call(e, n) && L(t, n, e[n]); | ||
| te.call(e, n) && $(t, n, e[n]); | ||
| if (R) | ||
| for (var n of R(e)) | ||
| ne.call(e, n) && $(t, n, e[n]); | ||
| return t; | ||
| }, B = (t, e) => Y(t, ee(e)); | ||
| import b from "fs"; | ||
| import i from "path"; | ||
| import I from "child_process"; | ||
| import R from "os"; | ||
| import a from "path"; | ||
| import I, { execSync as oe } from "child_process"; | ||
| import L from "os"; | ||
| import C from "chalk"; | ||
| import oe from "dotenv"; | ||
| import re from "dotenv"; | ||
| const z = { | ||
@@ -86,3 +86,3 @@ kiro: ["/Kiro.app/Contents/MacOS/Electron", "/Kiro.app/Contents/MacOS/Kiro"], | ||
| V[e] = e; | ||
| const re = B(v({}, V), { | ||
| const se = B(v({}, V), { | ||
| "/Sublime Text.app/Contents/MacOS/Sublime Text": "/Sublime Text.app/Contents/SharedSupport/bin/subl", | ||
@@ -139,3 +139,3 @@ "/Sublime Text.app/Contents/MacOS/sublime_text": "/Sublime Text.app/Contents/SharedSupport/bin/subl", | ||
| }); | ||
| const se = B(v({}, Q), { | ||
| const ie = B(v({}, Q), { | ||
| vscodium: "vscodium", | ||
@@ -184,4 +184,4 @@ codium: "codium", | ||
| const ae = J, q = { | ||
| darwin: re, | ||
| linux: se, | ||
| darwin: se, | ||
| linux: ie, | ||
| win32: ae | ||
@@ -193,12 +193,12 @@ }, D = { | ||
| }, m = "{file}", f = "{line}", x = "{column}"; | ||
| function ie(t, e, n, o) { | ||
| let r = "".concat(t, ":").concat(e, ":").concat(n); | ||
| function ce(t, e, n, o) { | ||
| let s = "".concat(t, ":").concat(e, ":").concat(n); | ||
| if (typeof o == "string") | ||
| r = o.replace(m, t).replace(f, e.toString()).replace(x, n.toString()); | ||
| s = o.replace(m, t).replace(f, e.toString()).replace(x, n.toString()); | ||
| else if (o instanceof Array) | ||
| return o.map((s) => s.replace(m, t).replace(f, e.toString()).replace(x, n.toString())); | ||
| return [r]; | ||
| return o.map((r) => r.replace(m, t).replace(f, e.toString()).replace(x, n.toString())); | ||
| return [s]; | ||
| } | ||
| const ce = ["-g", "-r", "{file}:{line}:{column}"]; | ||
| function le(t) { | ||
| const le = ["-g", "-r", "{file}:{line}:{column}"]; | ||
| function de(t) { | ||
| const { | ||
@@ -208,21 +208,21 @@ editorBasename: e, | ||
| lineNumber: o, | ||
| colNumber: r, | ||
| workspace: s, | ||
| openWindowParams: a, | ||
| colNumber: s, | ||
| workspace: r, | ||
| openWindowParams: i, | ||
| pathFormat: c | ||
| } = t, w = ue({ | ||
| } = t, w = pe({ | ||
| editorBasename: e, | ||
| openWindowParams: a, | ||
| workspace: s | ||
| }) || ce; | ||
| return ie(n, o, r, c || w); | ||
| openWindowParams: i, | ||
| workspace: r | ||
| }) || le; | ||
| return ce(n, o, s, c || w); | ||
| } | ||
| function de(t) { | ||
| let e = i.basename(t).replace(/\.(exe|cmd|bat|sh)$/i, ""); | ||
| function ue(t) { | ||
| let e = a.basename(t).replace(/\.(exe|cmd|bat|sh)$/i, ""); | ||
| const n = process.platform, o = Object.keys(D[n]); | ||
| for (let r = 0; r < o.length; r++) | ||
| if ((D[n][o[r]] || []).some( | ||
| (a) => t.toLowerCase().endsWith(a.toLowerCase()) | ||
| for (let s = 0; s < o.length; s++) | ||
| if ((D[n][o[s]] || []).some( | ||
| (i) => t.toLowerCase().endsWith(i.toLowerCase()) | ||
| )) { | ||
| e = o[r]; | ||
| e = o[s]; | ||
| break; | ||
@@ -232,3 +232,3 @@ } | ||
| } | ||
| function ue(t) { | ||
| function pe(t) { | ||
| const { editorBasename: e, openWindowParams: n, workspace: o } = t; | ||
@@ -314,3 +314,3 @@ switch (e) { | ||
| } | ||
| function pe(t) { | ||
| function me(t) { | ||
| let e = {}; | ||
@@ -320,12 +320,12 @@ process.env && (e = v({}, process.env)); | ||
| if (t) { | ||
| const o = i.resolve(t, ".env.local"); | ||
| const o = a.resolve(t, ".env.local"); | ||
| b.existsSync(o) && (n = o); | ||
| } | ||
| if (!n) { | ||
| const o = i.resolve(process.cwd(), ".env.local"); | ||
| const o = a.resolve(process.cwd(), ".env.local"); | ||
| b.existsSync(o) && (n = o); | ||
| } | ||
| if (n) { | ||
| const o = b.readFileSync(n, "utf-8"), r = oe.parse(o || ""); | ||
| e = v(v({}, r), e); | ||
| const o = b.readFileSync(n, "utf-8"), s = re.parse(o || ""); | ||
| e = v(v({}, s), e); | ||
| } | ||
@@ -335,5 +335,5 @@ return e; | ||
| function U(t, e) { | ||
| return pe(e)[t] || null; | ||
| return me(e)[t] || null; | ||
| } | ||
| const me = { | ||
| const fe = { | ||
| darwin: "ps ax -o comm=", | ||
@@ -343,26 +343,26 @@ linux: "ps -eo comm --sort=comm", | ||
| }; | ||
| function fe(t, e, n) { | ||
| function Ce(t, e, n) { | ||
| let o = null; | ||
| const r = U("CODE_EDITOR", e || ""); | ||
| if (r) { | ||
| const s = F(r); | ||
| if (s) | ||
| o = s; | ||
| const s = U("CODE_EDITOR", e || ""); | ||
| if (s) { | ||
| const r = j(s); | ||
| if (r) | ||
| o = r; | ||
| else | ||
| return [r]; | ||
| return [s]; | ||
| } | ||
| if (!o && t) { | ||
| const s = F(t); | ||
| s && (o = s); | ||
| const r = j(t); | ||
| r && (o = r); | ||
| } | ||
| if (!o && n) { | ||
| const s = he(); | ||
| if (s) | ||
| return [s]; | ||
| const r = be(); | ||
| if (r) | ||
| return [r]; | ||
| } | ||
| try { | ||
| let s; | ||
| const a = process.platform, c = process.platform === "win32", y = me[a], w = q[a]; | ||
| let r; | ||
| const i = process.platform, c = process.platform === "win32", g = fe[i], w = q[i]; | ||
| K(c); | ||
| const N = I.execSync(y, { encoding: "utf-8" }), h = Object.keys(w), g = N.split(c ? "\r\n" : "\n").map((M) => M.trim()); | ||
| const N = I.execSync(g, { encoding: "utf-8" }), h = Object.keys(w), y = N.split(c ? "\r\n" : "\n").map((M) => M.trim()); | ||
| for (let M = 0; M < h.length; M++) { | ||
@@ -372,8 +372,8 @@ const l = h[M]; | ||
| if (c) { | ||
| const u = g.find( | ||
| (P) => i.basename(P).toLowerCase() === l.toLowerCase() | ||
| const u = y.find( | ||
| (P) => a.basename(P).toLowerCase() === l.toLowerCase() | ||
| ); | ||
| u && (E = i.basename(u), S = Ce(u)); | ||
| } else if (a === "darwin") { | ||
| const u = g.find( | ||
| u && (E = a.basename(u), S = he(u)); | ||
| } else if (i === "darwin") { | ||
| const u = y.find( | ||
| (P) => P.toLowerCase().endsWith(l.toLowerCase()) | ||
@@ -390,18 +390,18 @@ ); | ||
| return [S]; | ||
| s || (s = [S]); | ||
| r || (r = [S]); | ||
| } | ||
| } | ||
| if (s) | ||
| return s; | ||
| } catch (s) { | ||
| if (r) | ||
| return r; | ||
| } catch (r) { | ||
| } | ||
| return process.env.VISUAL ? [process.env.VISUAL] : process.env.EDITOR ? [process.env.EDITOR] : [null]; | ||
| } | ||
| const F = (t) => { | ||
| const j = (t) => { | ||
| const e = process.platform; | ||
| return D[e] && D[e][t] || null; | ||
| }; | ||
| function Ce(t) { | ||
| if (i.basename(t).toLowerCase() === "zed.exe") { | ||
| const e = i.join(i.dirname(t), "bin", "zed.exe"); | ||
| function he(t) { | ||
| if (a.basename(t).toLowerCase() === "zed.exe") { | ||
| const e = a.join(a.dirname(t), "bin", "zed.exe"); | ||
| if (b.existsSync(e)) | ||
@@ -419,6 +419,6 @@ return e; | ||
| }; | ||
| function he() { | ||
| function be() { | ||
| const t = process.platform, e = Object.keys(q[t]); | ||
| try { | ||
| return be(process.pid, t, e); | ||
| return Se(process.pid, t, e); | ||
| } catch (n) { | ||
@@ -428,23 +428,23 @@ return console.log(C.red("Error while getting editor by PID:"), n), null; | ||
| } | ||
| function be(t, e, n) { | ||
| function Se(t, e, n) { | ||
| let o = 0; | ||
| const r = 50, s = 0; | ||
| for (; t && t !== s && o < r; ) { | ||
| const a = Se(t, e); | ||
| if (!a) | ||
| const s = 50, r = 0; | ||
| for (; t && t !== r && o < s; ) { | ||
| const i = Oe(t, e); | ||
| if (!i) | ||
| break; | ||
| const { command: c, parentPid: y } = a; | ||
| if (ge(c, n)) | ||
| const { command: c, parentPid: g } = i; | ||
| if (ve(c, n)) | ||
| return c; | ||
| t = y, o++; | ||
| t = g, o++; | ||
| } | ||
| return null; | ||
| } | ||
| function Se(t, e) { | ||
| function Oe(t, e) { | ||
| switch (e) { | ||
| case "darwin": | ||
| case "linux": | ||
| return Oe(t); | ||
| return xe(t); | ||
| case "win32": | ||
| return xe(t); | ||
| return ge(t); | ||
| default: | ||
@@ -454,3 +454,3 @@ return null; | ||
| } | ||
| function Oe(t) { | ||
| function xe(t) { | ||
| try { | ||
@@ -465,3 +465,3 @@ const n = I.execSync("ps -p ".concat(t, " -o ppid=,comm="), { | ||
| } | ||
| function xe(t) { | ||
| function ge(t) { | ||
| try { | ||
@@ -471,9 +471,9 @@ K(!0); | ||
| encoding: "utf8" | ||
| }).trim().split("\r\n").filter((a) => a.trim()).slice(1); | ||
| }).trim().split("\r\n").filter((i) => i.trim()).slice(1); | ||
| if (o.length === 0) | ||
| return null; | ||
| const [r, s] = o[0].split(","); | ||
| return !s || !r ? null : { | ||
| command: s.slice(1, -1), | ||
| parentPid: Number(r.slice(1, -1)) | ||
| const [s, r] = o[0].split(","); | ||
| return !r || !s ? null : { | ||
| command: r.slice(1, -1), | ||
| parentPid: Number(s.slice(1, -1)) | ||
| }; | ||
@@ -491,3 +491,3 @@ } catch (e) { | ||
| } | ||
| function ge(t, e) { | ||
| function ve(t, e) { | ||
| return e.some( | ||
@@ -497,3 +497,3 @@ (n) => t.toLowerCase().endsWith(n.toLowerCase()) | ||
| } | ||
| const ve = 262, A = /* @__PURE__ */ new Map(), we = /* @__PURE__ */ new Set([ | ||
| const we = 262, A = /* @__PURE__ */ new Map(), Me = /* @__PURE__ */ new Set([ | ||
| "appcode", | ||
@@ -517,31 +517,44 @@ "clion", | ||
| ]); | ||
| function Me(t) { | ||
| return we.has(t); | ||
| function Ee(t) { | ||
| return Me.has(t); | ||
| } | ||
| function Ee(t, e) { | ||
| function Pe() { | ||
| try { | ||
| return oe("git rev-parse --show-toplevel", { | ||
| encoding: "utf8", | ||
| stdio: ["pipe", "pipe", "pipe"] | ||
| }).trim(); | ||
| } catch (t) { | ||
| return ""; | ||
| } | ||
| } | ||
| function Ie(t, e) { | ||
| if (e) { | ||
| const r = i.resolve(e); | ||
| const r = a.resolve(e); | ||
| if (b.existsSync(r)) | ||
| return r; | ||
| } | ||
| const n = []; | ||
| let o = i.dirname(i.resolve(t)); | ||
| const n = Pe(); | ||
| if (n) | ||
| return n; | ||
| const o = []; | ||
| let s = a.dirname(a.resolve(t)); | ||
| for (; ; ) { | ||
| n.push(o); | ||
| const r = i.dirname(o); | ||
| if (r === o) | ||
| o.push(s); | ||
| const r = a.dirname(s); | ||
| if (r === s) | ||
| break; | ||
| o = r; | ||
| s = r; | ||
| } | ||
| for (const r of [".idea", ".git"]) { | ||
| const s = n.find( | ||
| (a) => b.existsSync(i.join(a, r)) | ||
| const i = o.find( | ||
| (c) => b.existsSync(a.join(c, r)) | ||
| ); | ||
| if (s) | ||
| return s; | ||
| if (i) | ||
| return i; | ||
| } | ||
| return i.dirname(i.resolve(t)); | ||
| return a.dirname(a.resolve(t)); | ||
| } | ||
| function Pe(t) { | ||
| const e = t.includes(i.sep) ? [t] : (process.env.PATH || "").split(i.delimiter).filter(Boolean).map((n) => i.join(n, t)); | ||
| function Ne(t) { | ||
| const e = t.includes(a.sep) ? [t] : (process.env.PATH || "").split(a.delimiter).filter(Boolean).map((n) => a.join(n, t)); | ||
| for (const n of e) | ||
@@ -555,39 +568,39 @@ try { | ||
| } | ||
| function Ie(t) { | ||
| const e = i.dirname(t); | ||
| function _e(t) { | ||
| const e = a.dirname(t); | ||
| return [ | ||
| // macOS: <IDE>.app/Contents/MacOS/<launcher> | ||
| i.resolve(e, "../Resources/product-info.json"), | ||
| a.resolve(e, "../Resources/product-info.json"), | ||
| // Linux/Windows: <IDE>/bin/<launcher> | ||
| i.resolve(e, "../product-info.json") | ||
| a.resolve(e, "../product-info.json") | ||
| ]; | ||
| } | ||
| function Ne(t) { | ||
| function Te(t) { | ||
| const e = Number.parseInt(t.buildNumber || "", 10); | ||
| if (!Number.isNaN(e)) | ||
| return e >= ve; | ||
| return e >= we; | ||
| const n = /^(\d{4})\.(\d+)/.exec(t.version || ""); | ||
| if (!n) | ||
| return !1; | ||
| const o = Number(n[1]), r = Number(n[2]); | ||
| return o > 2026 || o === 2026 && r >= 2; | ||
| const o = Number(n[1]), s = Number(n[2]); | ||
| return o > 2026 || o === 2026 && s >= 2; | ||
| } | ||
| function _e(t) { | ||
| function Be(t) { | ||
| const e = A.get(t); | ||
| if (e !== void 0) | ||
| return e; | ||
| const n = Pe(t); | ||
| const n = Ne(t); | ||
| if (!n) | ||
| return A.set(t, !1), !1; | ||
| for (const o of Ie(n)) | ||
| for (const o of _e(n)) | ||
| try { | ||
| const r = JSON.parse( | ||
| const s = JSON.parse( | ||
| b.readFileSync(o, "utf8") | ||
| ), s = Ne(r); | ||
| return A.set(t, s), s; | ||
| } catch (r) { | ||
| ), r = Te(s); | ||
| return A.set(t, r), r; | ||
| } catch (s) { | ||
| } | ||
| return A.set(t, !1), !1; | ||
| } | ||
| function Te(t) { | ||
| function Ae(t) { | ||
| switch (t) { | ||
@@ -601,3 +614,3 @@ case "vim": | ||
| } | ||
| function Be(t) { | ||
| function De(t) { | ||
| const e = U( | ||
@@ -615,5 +628,5 @@ "CODE_INSPECTOR_FORMAT_PATH", | ||
| } | ||
| function Ae(t, e) { | ||
| function ke(t, e) { | ||
| console.log( | ||
| C.red("Could not open " + i.basename(t) + " in the editor.") | ||
| C.red("Could not open " + a.basename(t) + " in the editor.") | ||
| ), e && (e[e.length - 1] !== "." && (e += "."), console.log( | ||
@@ -626,6 +639,6 @@ C.red("The editor process exited with an error: " + e) | ||
| let O = null; | ||
| function De(t) { | ||
| function Re(t) { | ||
| return t === "reuse" ? "-r" : t === "new" ? "-n" : ""; | ||
| } | ||
| function j(t, e) { | ||
| function F(t, e) { | ||
| const n = B(v({}, process.env), { | ||
@@ -635,4 +648,4 @@ NODE_OPTIONS: "" | ||
| if (process.platform === "win32") { | ||
| const o = (a) => a.replace(/([&|<>,;=^])/g, "^$1"), r = (a) => a.includes("^") ? '^"'.concat(a, '^"') : a.includes(" ") ? '"'.concat(a, '"') : a, s = [t, ...e.map(o)].map(r).join(" "); | ||
| return I.exec(s, { | ||
| const o = (i) => i.replace(/([&|<>,;=^])/g, "^$1"), s = (i) => i.includes("^") ? '^"'.concat(i, '^"') : i.includes(" ") ? '"'.concat(i, '"') : i, r = [t, ...e.map(o)].map(s).join(" "); | ||
| return I.exec(r, { | ||
| // @ts-ignore | ||
@@ -648,3 +661,3 @@ shell: !0, | ||
| } | ||
| function ze(t) { | ||
| function He(t) { | ||
| let { | ||
@@ -654,7 +667,7 @@ file: e, | ||
| column: o = 1, | ||
| editor: r, | ||
| method: s, | ||
| format: a, | ||
| editor: s, | ||
| method: r, | ||
| format: i, | ||
| onError: c, | ||
| rootDir: y, | ||
| rootDir: g, | ||
| usePid: w, | ||
@@ -665,6 +678,6 @@ type: N = "exec" | ||
| return; | ||
| let [h, ...g] = fe(r, y, w); | ||
| const M = g.filter((d) => d !== null); | ||
| let [h, ...y] = Ce(s, g, w); | ||
| const M = y.filter((d) => d !== null); | ||
| let l = null; | ||
| const S = Be(y || "") || a; | ||
| const S = De(g || "") || i; | ||
| if (!h || h.toLowerCase() === "none") { | ||
@@ -676,3 +689,3 @@ typeof c == "function" ? c(e, "Failed to recognize IDE automatically") : console.log( | ||
| } | ||
| const E = h, u = de( | ||
| const E = h, u = ue( | ||
| h | ||
@@ -689,5 +702,5 @@ ); | ||
| } else { | ||
| process.platform === "linux" && e.startsWith("/mnt/") && /Microsoft/i.test(R.release()) && (e = i.relative("", e)); | ||
| let p = _e(h) ? Ee(e, y) : null; | ||
| p && process.platform === "linux" && p.startsWith("/mnt/") && /Microsoft/i.test(R.release()) && (p = i.relative("", p)), n ? (Me(u) && (l = M.concat([ | ||
| process.platform === "linux" && e.startsWith("/mnt/") && /Microsoft/i.test(L.release()) && (e = a.relative("", e)); | ||
| let p = Be(h) ? Ie(e, g) : null; | ||
| p && process.platform === "linux" && p.startsWith("/mnt/") && /Microsoft/i.test(L.release()) && (p = a.relative("", p)), n ? (Ee(u) && (l = M.concat([ | ||
| e, | ||
@@ -698,4 +711,4 @@ "--line", | ||
| String(o) | ||
| ])), g = g.concat( | ||
| le({ | ||
| ])), y = y.concat( | ||
| de({ | ||
| editorBasename: u, | ||
@@ -706,9 +719,9 @@ fileName: e, | ||
| workspace: p, | ||
| openWindowParams: De(s), | ||
| openWindowParams: Re(r), | ||
| pathFormat: S | ||
| }) | ||
| )) : g.push(e), O && Te(h) && O.kill("SIGKILL"), O = j(h, g); | ||
| )) : y.push(e), O && Ae(h) && O.kill("SIGKILL"), O = F(h, y); | ||
| } | ||
| const P = (d) => { | ||
| typeof c == "function" ? c(e, d) : Ae(e, d); | ||
| typeof c == "function" ? c(e, d) : ke(e, d); | ||
| }, _ = (d) => { | ||
@@ -720,3 +733,3 @@ let p = !1; | ||
| const Z = l; | ||
| l = null, O = j(E, Z), _(O); | ||
| l = null, O = F(E, Z), _(O); | ||
| return; | ||
@@ -736,6 +749,6 @@ } | ||
| export { | ||
| ie as formatOpenPath, | ||
| ce as formatOpenPath, | ||
| U as getEnvVariable, | ||
| pe as getEnvVariables, | ||
| ze as launchIDE | ||
| me as getEnvVariables, | ||
| He as launchIDE | ||
| }; |
+1
-1
| { | ||
| "name": "launch-ide", | ||
| "version": "1.4.6", | ||
| "version": "1.4.7", | ||
| "main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "./dist/index.mjs", |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
49952
0.84%856
1.66%