🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

launch-ide

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

launch-ide - npm Package Compare versions

Comparing version
1.4.5
to
1.4.6
+3
types/jetbrains.d.ts
export declare function isJetBrainsEditor(editorBasename: string): boolean;
export declare function getJetBrainsWorkspace(file: string, rootDir?: string): string;
export declare function usesJetBrainsNewCli(editor: string): boolean;
+1
-1

@@ -1,1 +0,1 @@

"use strict";var H=Object.defineProperty,K=Object.defineProperties;var U=Object.getOwnPropertyDescriptors;var D=Object.getOwnPropertySymbols;var Z=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable;var B=(t,e,n)=>e in t?H(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,S=(t,e)=>{for(var n in e||(e={}))Z.call(e,n)&&B(t,n,e[n]);if(D)for(var n of D(e))G.call(e,n)&&B(t,n,e[n]);return t},I=(t,e)=>K(t,U(e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("fs"),f=require("path"),w=require("child_process"),J=require("os"),m=require("chalk"),Y=require("dotenv"),L={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"]},R={};for(let t of Object.values(L))for(let e of t)R[e]=e;const ee=I(S({},R),{"/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"}),A={kiro:"kiro",cursor:"cursor",comate:"comate",qoder:"qoder",devin:"devin",windsurf:"windsurf",trae:"trae",codebuddy:"codebuddy",antigravity:"antigravity",code:"vscode",codium:"vscodium",zed:"zed"},W={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"]},F={};Object.entries(W).forEach(([t,e])=>{for(let n of e)F[n]=t});const te=I(S({},F),{vscodium:"vscodium",codium:"codium",hbuilderx:"hbuilderx","hbuilderx.sh":"hbuilderx",gvim:"gvim",sublime_text:"subl"}),z={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"]},V={};for(let t of Object.values(z))for(let e of t)V[e]="";const ne=V,j={darwin:ee,linux:te,win32:ne},_={darwin:L,linux:W,win32:z},p="{file}",u="{line}",g="{column}";function q(t,e,n,o){let s="".concat(t,":").concat(e,":").concat(n);if(typeof o=="string")s=o.replace(p,t).replace(u,e.toString()).replace(g,n.toString());else if(o instanceof Array)return o.map(r=>r.replace(p,t).replace(u,e.toString()).replace(g,n.toString()));return[s]}const oe=["-g","-r","{file}:{line}:{column}"];function re(t){const{editorBasename:e,fileName:n,lineNumber:o,colNumber:s,workspace:r,openWindowParams:i,pathFormat:c}=t,v=ae({editorBasename:e,openWindowParams:i,workspace:r})||oe;return q(n,o,s,c||v)}function se(t){let e=f.basename(t).replace(/\.(exe|cmd|bat|sh)$/i,"");const n=process.platform,o=Object.keys(_[n]);for(let s=0;s<o.length;s++)if((_[n][o[s]]||[]).some(i=>t.toLowerCase().endsWith(i.toLowerCase()))){e=o[s];break}return e.toLowerCase()}function ae(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(p,":").concat(u,":").concat(g);case"notepad++":return["-n"+u,"-c"+g,p];case"vim":case"mvim":return["+call cursor(".concat(u,", ").concat(g,")"),p];case"joe":case"gvim":return["+"+u,p];case"emacs":case"emacsclient":return["+"+u+":"+g,p];case"rmate":case"mate":case"mine":return["--line",u,p];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(p,":").concat(u,":").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",u,p];case"zed":return[n==="-n"?"-n":"-a","".concat(p,":").concat(u,":").concat(g)]}return""}function Q(t){let e={};process.env&&(e=S({},process.env));let n="";if(t){const o=f.resolve(t,".env.local");T.existsSync(o)&&(n=o)}if(!n){const o=f.resolve(process.cwd(),".env.local");T.existsSync(o)&&(n=o)}if(n){const o=T.readFileSync(n,"utf-8"),s=Y.parse(o||"");e=S(S({},s),e)}return e}function N(t,e){return Q(e)[t]||null}const ce={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 ie(t,e,n){let o=null;const s=N("CODE_EDITOR",e||"");if(s){const r=$(s);if(r)o=r;else return[s]}if(!o&&t){const r=$(t);r&&(o=r)}if(!o&&n){const r=le();if(r)return[r]}try{let r;const i=process.platform,c=process.platform==="win32",y=ce[i],v=j[i];X(c);const P=w.execSync(y,{encoding:"utf-8"}),C=Object.keys(v),b=P.split(c?"\r\n":"\n").map(M=>M.trim());for(let M=0;M<C.length;M++){const d=C[M];let a="",h="";if(c){const O=b.find(E=>f.basename(E).toLowerCase()===d.toLowerCase());O&&(h=f.basename(O),a=de(O))}else if(i==="darwin"){const O=b.find(E=>E.toLowerCase().endsWith(d.toLowerCase()));if(O){const E=O.replace(d,""),l=v[d];h=d,l.includes("/")?a="".concat(E).concat(l):a=l}}else P.indexOf(d)!==-1&&(h=d,a=v[d]);if(h&&a){if(o!=null&&o.includes(h))return[a];r||(r=[a])}}if(r)return r}catch(r){}return process.env.VISUAL?[process.env.VISUAL]:process.env.EDITOR?[process.env.EDITOR]:[null]}const $=t=>{const e=process.platform;return _[e]&&_[e][t]||null};function de(t){if(f.basename(t).toLowerCase()==="zed.exe"){const e=f.join(f.dirname(t),"bin","zed.exe");if(T.existsSync(e))return e}return t}const X=t=>{if(t)try{w.execSync("chcp 65001")}catch(e){}};function le(){const t=process.platform,e=Object.keys(j[t]);try{return pe(process.pid,t,e)}catch(n){return console.log(m.red("Error while getting editor by PID:"),n),null}}function pe(t,e,n){let o=0;const s=50,r=0;for(;t&&t!==r&&o<s;){const i=ue(t,e);if(!i)break;const{command:c,parentPid:y}=i;if(he(c,n))return c;t=y,o++}return null}function ue(t,e){switch(e){case"darwin":case"linux":return me(t);case"win32":return fe(t);default:return null}}function me(t){try{const n=w.execSync("ps -p ".concat(t," -o ppid=,comm="),{encoding:"utf8"}).trim().split("\n");return n.length?Ce(n[0].trim()):null}catch(e){return null}}function fe(t){try{X(!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(i=>i.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 Ce(t){const e=t.match(/^(\d+)\s+(.+)$/);return e?{command:e[2],parentPid:parseInt(e[1])}:null}function he(t,e){return e.some(n=>t.toLowerCase().endsWith(n.toLowerCase()))}function Se(t){switch(t){case"vim":case"emacs":case"nano":return!0}return!1}function be(t){const e=N("CODE_INSPECTOR_FORMAT_PATH",t);if(e)try{return JSON.parse(e)}catch(n){return null}return null}function k(t,e){console.log(m.red("Could not open "+f.basename(t)+" in the editor.")),e&&(e[e.length-1]!=="."&&(e+="."),console.log(m.red("The editor process exited with an error: "+e))),console.log("To set up the editor integration, add something like "+m.cyan("CODE_EDITOR=code")+" to the "+m.green(".env.local")+" file in your project folder, or add "+m.green('editor: "code"')+" to CodeInspectorPlugin config, and then restart the development server. Learn more: "+m.green("https://goo.gl/MMTaZt"))}let x=null;function Oe(t){return t==="reuse"?"-r":t==="new"?"-n":""}function xe(t){let{file:e,line:n=1,column:o=1,editor:s,method:r,format:i,onError:c,rootDir:y,usePid:v,type:P="exec"}=t;if(!T.existsSync(e))return;let[C,...b]=ie(s,y,v);const M=be(y||"")||i;if(!C||C.toLowerCase()==="none"){typeof c=="function"?c(e,"Failed to recognize IDE automatically"):console.log("Failed to recognize IDE automatically, add something like "+m.cyan("CODE_EDITOR=code")+" to the "+m.green(".env.local")+" file in your project folder, or add "+m.green('editor: "code"')+" to CodeInspectorPlugin config, and then restart the development server. Learn more: "+m.green("https://goo.gl/MMTaZt"));return}const d=se(C);if((P==="open"||P==="open-bg")&&process.platform==="darwin"&&A[d]){const a="".concat(A[d],"://file").concat(e,":").concat(n,":").concat(o),h=P==="open-bg"?["-g",a]:[a];x=w.spawn("open",h,{stdio:"ignore",env:I(S({},process.env),{NODE_OPTIONS:""})})}else{process.platform==="linux"&&e.startsWith("/mnt/")&&/Microsoft/i.test(J.release())&&(e=f.relative("",e));let a=null;if(n?b=b.concat(re({editorBasename:d,fileName:e,lineNumber:n,colNumber:o,workspace:a,openWindowParams:Oe(r),pathFormat:M})):b.push(e),x&&Se(C)&&x.kill("SIGKILL"),process.platform==="win32"){const h=l=>l.replace(/([&|<>,;=^])/g,"^$1"),O=l=>l.includes("^")?'^"'.concat(l,'^"'):l.includes(" ")?'"'.concat(l,'"'):l,E=[C,...b.map(h)].map(O).join(" ");x=w.exec(E,{stdio:"ignore",shell:!0,env:I(S({},process.env),{NODE_OPTIONS:""})})}else x=w.spawn(C,b,{stdio:"ignore",env:I(S({},process.env),{NODE_OPTIONS:""})})}x.on("exit",function(a){x=null,a&&(typeof c=="function"?c(e,"(code "+a+")"):k(e,"(code "+a+")"))}),x.on("error",function(a){typeof c=="function"?c(e,a.message):k(e,a.message)})}exports.formatOpenPath=q;exports.getEnvVariable=N;exports.getEnvVariables=Q;exports.launchIDE=xe;
"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;

@@ -1,20 +0,20 @@

var X = Object.defineProperty, H = Object.defineProperties;
var q = Object.getOwnPropertyDescriptors;
var N = Object.getOwnPropertySymbols;
var K = Object.prototype.hasOwnProperty, U = Object.prototype.propertyIsEnumerable;
var D = (t, e, o) => e in t ? X(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o, S = (t, e) => {
for (var o in e || (e = {}))
K.call(e, o) && D(t, o, e[o]);
if (N)
for (var o of N(e))
U.call(e, o) && D(t, o, e[o]);
var G = Object.defineProperty, Y = Object.defineProperties;
var ee = Object.getOwnPropertyDescriptors;
var $ = 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) => {
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]);
return t;
}, I = (t, e) => H(t, q(e));
import T from "fs";
import f from "path";
import w from "child_process";
import Z from "os";
import m from "chalk";
import G from "dotenv";
const k = {
}, 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 C from "chalk";
import oe from "dotenv";
const z = {
kiro: ["/Kiro.app/Contents/MacOS/Electron", "/Kiro.app/Contents/MacOS/Kiro"],

@@ -82,7 +82,7 @@ cursor: ["/Cursor.app/Contents/MacOS/Cursor"],

zed: ["/Zed.app/Contents/MacOS/zed", "/Zed.app/Contents/MacOS/cli"]
}, L = {};
for (let t of Object.values(k))
}, V = {};
for (let t of Object.values(z))
for (let e of t)
L[e] = e;
const J = I(S({}, L), {
V[e] = e;
const re = B(v({}, V), {
"/Sublime Text.app/Contents/MacOS/Sublime Text": "/Sublime Text.app/Contents/SharedSupport/bin/subl",

@@ -94,3 +94,3 @@ "/Sublime Text.app/Contents/MacOS/sublime_text": "/Sublime Text.app/Contents/SharedSupport/bin/subl",

"/Zed.app/Contents/MacOS/zed": "/Zed.app/Contents/MacOS/cli"
}), B = {
}), W = {
kiro: "kiro",

@@ -108,3 +108,3 @@ cursor: "cursor",

zed: "zed"
}, R = {
}, H = {
kiro: ["kiro"],

@@ -136,8 +136,8 @@ antigravity: ["antigravity"],

zed: ["zed"]
}, W = {};
Object.entries(R).forEach(([t, e]) => {
for (let o of e)
W[o] = t;
}, Q = {};
Object.entries(H).forEach(([t, e]) => {
for (let n of e)
Q[n] = t;
});
const Y = I(S({}, W), {
const se = B(v({}, Q), {
vscodium: "vscodium",

@@ -149,3 +149,3 @@ codium: "codium",

sublime_text: "subl"
}), F = {
}), X = {
kiro: ["Kiro.exe"],

@@ -182,44 +182,48 @@ antigravity: ["Antigravity.exe"],

zed: ["zed.exe"]
}, z = {};
for (let t of Object.values(F))
}, J = {};
for (let t of Object.values(X))
for (let e of t)
z[e] = "";
const ee = z, V = {
darwin: J,
linux: Y,
win32: ee
}, _ = {
darwin: k,
linux: R,
win32: F
}, p = "{file}", u = "{line}", g = "{column}";
function te(t, e, o, n) {
let s = "".concat(t, ":").concat(e, ":").concat(o);
if (typeof n == "string")
s = n.replace(p, t).replace(u, e.toString()).replace(g, o.toString());
else if (n instanceof Array)
return n.map((r) => r.replace(p, t).replace(u, e.toString()).replace(g, o.toString()));
return [s];
J[e] = "";
const ae = J, q = {
darwin: re,
linux: se,
win32: ae
}, D = {
darwin: z,
linux: H,
win32: X
}, m = "{file}", f = "{line}", x = "{column}";
function ie(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 oe = ["-g", "-r", "{file}:{line}:{column}"];
function ne(t) {
const ce = ["-g", "-r", "{file}:{line}:{column}"];
function le(t) {
const {
editorBasename: e,
fileName: o,
lineNumber: n,
colNumber: s,
workspace: r,
openWindowParams: i,
fileName: n,
lineNumber: o,
colNumber: r,
workspace: s,
openWindowParams: a,
pathFormat: c
} = t, v = se({ editorBasename: e, openWindowParams: i, workspace: r }) || oe;
return te(o, n, s, c || v);
} = t, w = ue({
editorBasename: e,
openWindowParams: a,
workspace: s
}) || ce;
return ie(n, o, r, c || w);
}
function re(t) {
let e = f.basename(t).replace(/\.(exe|cmd|bat|sh)$/i, "");
const o = process.platform, n = Object.keys(_[o]);
for (let s = 0; s < n.length; s++)
if ((_[o][n[s]] || []).some(
(i) => t.toLowerCase().endsWith(i.toLowerCase())
function de(t) {
let e = i.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())
)) {
e = n[s];
e = o[r];
break;

@@ -229,4 +233,4 @@ }

}
function se(t) {
const { editorBasename: e, openWindowParams: o, workspace: n } = t;
function ue(t) {
const { editorBasename: e, openWindowParams: n, workspace: o } = t;
switch (e) {

@@ -240,18 +244,18 @@ case "atom":

case "charm":
return "".concat(p, ":").concat(u, ":").concat(g);
return "".concat(m, ":").concat(f, ":").concat(x);
case "notepad++":
return ["-n" + u, "-c" + g, p];
return ["-n" + f, "-c" + x, m];
case "vim":
case "mvim":
return ["+call cursor(".concat(u, ", ").concat(g, ")"), p];
return ["+call cursor(".concat(f, ", ").concat(x, ")"), m];
case "joe":
case "gvim":
return ["+" + u, p];
return ["+" + f, m];
case "emacs":
case "emacsclient":
return ["+" + u + ":" + g, p];
return ["+" + f + ":" + x, m];
case "rmate":
case "mate":
case "mine":
return ["--line", u, p];
return ["--line", f, m];
case "code":

@@ -274,6 +278,6 @@ case "code-insiders":

return [
...o ? [o] : [],
"-g",
...n ? [n] : [],
"-g",
...o ? [o] : [],
"".concat(p, ":").concat(u, ":").concat(g)
"".concat(m, ":").concat(f, ":").concat(x)
];

@@ -298,11 +302,13 @@ case "appcode":

return [
...n ? [n] : [],
...o ? [o] : [],
"--line",
u,
p
f,
"--column",
x,
m
];
case "zed":
return [
o === "-n" ? "-n" : "-a",
"".concat(p, ":").concat(u, ":").concat(g)
n === "-n" ? "-n" : "-a",
"".concat(m, ":").concat(f, ":").concat(x)
];

@@ -312,24 +318,24 @@ }

}
function ae(t) {
function pe(t) {
let e = {};
process.env && (e = S({}, process.env));
let o = "";
process.env && (e = v({}, process.env));
let n = "";
if (t) {
const n = f.resolve(t, ".env.local");
T.existsSync(n) && (o = n);
const o = i.resolve(t, ".env.local");
b.existsSync(o) && (n = o);
}
if (!o) {
const n = f.resolve(process.cwd(), ".env.local");
T.existsSync(n) && (o = n);
if (!n) {
const o = i.resolve(process.cwd(), ".env.local");
b.existsSync(o) && (n = o);
}
if (o) {
const n = T.readFileSync(o, "utf-8"), s = G.parse(n || "");
e = S(S({}, s), e);
if (n) {
const o = b.readFileSync(n, "utf-8"), r = oe.parse(o || "");
e = v(v({}, r), e);
}
return e;
}
function j(t, e) {
return ae(e)[t] || null;
function U(t, e) {
return pe(e)[t] || null;
}
const ce = {
const me = {
darwin: "ps ax -o comm=",

@@ -339,64 +345,64 @@ linux: "ps -eo comm --sort=comm",

};
function ie(t, e, o) {
let n = null;
const s = j("CODE_EDITOR", e || "");
if (s) {
const r = A(s);
if (r)
n = r;
function fe(t, e, n) {
let o = null;
const r = U("CODE_EDITOR", e || "");
if (r) {
const s = F(r);
if (s)
o = s;
else
return [s];
return [r];
}
if (!n && t) {
const r = A(t);
r && (n = r);
if (!o && t) {
const s = F(t);
s && (o = s);
}
if (!n && o) {
const r = le();
if (r)
return [r];
if (!o && n) {
const s = he();
if (s)
return [s];
}
try {
let r;
const i = process.platform, c = process.platform === "win32", y = ce[i], v = V[i];
Q(c);
const P = w.execSync(y, { encoding: "utf-8" }), C = Object.keys(v), b = P.split(c ? "\r\n" : "\n").map((M) => M.trim());
for (let M = 0; M < C.length; M++) {
const d = C[M];
let a = "", h = "";
let s;
const a = process.platform, c = process.platform === "win32", y = me[a], w = q[a];
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());
for (let M = 0; M < h.length; M++) {
const l = h[M];
let S = "", E = "";
if (c) {
const O = b.find(
(E) => f.basename(E).toLowerCase() === d.toLowerCase()
const u = g.find(
(P) => i.basename(P).toLowerCase() === l.toLowerCase()
);
O && (h = f.basename(O), a = de(O));
} else if (i === "darwin") {
const O = b.find(
(E) => E.toLowerCase().endsWith(d.toLowerCase())
u && (E = i.basename(u), S = Ce(u));
} else if (a === "darwin") {
const u = g.find(
(P) => P.toLowerCase().endsWith(l.toLowerCase())
);
if (O) {
const E = O.replace(d, ""), l = v[d];
h = d, l.includes("/") ? a = "".concat(E).concat(l) : a = l;
if (u) {
const P = u.replace(l, ""), _ = w[l];
E = l, _.includes("/") ? S = "".concat(P).concat(_) : S = _;
}
} else
P.indexOf(d) !== -1 && (h = d, a = v[d]);
if (h && a) {
if (n != null && n.includes(h))
return [a];
r || (r = [a]);
N.indexOf(l) !== -1 && (E = l, S = w[l]);
if (E && S) {
if (o != null && o.includes(E))
return [S];
s || (s = [S]);
}
}
if (r)
return r;
} catch (r) {
if (s)
return s;
} catch (s) {
}
return process.env.VISUAL ? [process.env.VISUAL] : process.env.EDITOR ? [process.env.EDITOR] : [null];
}
const A = (t) => {
const F = (t) => {
const e = process.platform;
return _[e] && _[e][t] || null;
return D[e] && D[e][t] || null;
};
function de(t) {
if (f.basename(t).toLowerCase() === "zed.exe") {
const e = f.join(f.dirname(t), "bin", "zed.exe");
if (T.existsSync(e))
function Ce(t) {
if (i.basename(t).toLowerCase() === "zed.exe") {
const e = i.join(i.dirname(t), "bin", "zed.exe");
if (b.existsSync(e))
return e;

@@ -406,38 +412,38 @@ }

}
const Q = (t) => {
const K = (t) => {
if (t)
try {
w.execSync("chcp 65001");
I.execSync("chcp 65001");
} catch (e) {
}
};
function le() {
const t = process.platform, e = Object.keys(V[t]);
function he() {
const t = process.platform, e = Object.keys(q[t]);
try {
return pe(process.pid, t, e);
} catch (o) {
return console.log(m.red("Error while getting editor by PID:"), o), null;
return be(process.pid, t, e);
} catch (n) {
return console.log(C.red("Error while getting editor by PID:"), n), null;
}
}
function pe(t, e, o) {
let n = 0;
const s = 50, r = 0;
for (; t && t !== r && n < s; ) {
const i = ue(t, e);
if (!i)
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: c, parentPid: y } = i;
if (he(c, o))
const { command: c, parentPid: y } = a;
if (ge(c, n))
return c;
t = y, n++;
t = y, o++;
}
return null;
}
function ue(t, e) {
function Se(t, e) {
switch (e) {
case "darwin":
case "linux":
return me(t);
return Oe(t);
case "win32":
return fe(t);
return xe(t);
default:

@@ -447,8 +453,8 @@ return null;

}
function me(t) {
function Oe(t) {
try {
const o = w.execSync("ps -p ".concat(t, " -o ppid=,comm="), {
const n = I.execSync("ps -p ".concat(t, " -o ppid=,comm="), {
encoding: "utf8"
}).trim().split("\n");
return o.length ? Ce(o[0].trim()) : null;
return n.length ? ye(n[0].trim()) : null;
} catch (e) {

@@ -458,14 +464,14 @@ return null;

}
function fe(t) {
function xe(t) {
try {
Q(!0);
const e = 'powershell -NoProfile -Command "Get-CimInstance -ClassName Win32_Process -Filter "ProcessId='.concat(t, '" | Select-Object ParentProcessId, ExecutablePath | ConvertTo-Csv -NoTypeInformation'), n = w.execSync(e, {
K(!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((i) => i.trim()).slice(1);
if (n.length === 0)
}).trim().split("\r\n").filter((a) => a.trim()).slice(1);
if (o.length === 0)
return null;
const [s, r] = n[0].split(",");
return !r || !s ? null : {
command: r.slice(1, -1),
parentPid: Number(s.slice(1, -1))
const [r, s] = o[0].split(",");
return !s || !r ? null : {
command: s.slice(1, -1),
parentPid: Number(r.slice(1, -1))
};

@@ -476,3 +482,3 @@ } catch (e) {

}
function Ce(t) {
function ye(t) {
const e = t.match(/^(\d+)\s+(.+)$/);

@@ -484,8 +490,100 @@ return e ? {

}
function he(t, e) {
function ge(t, e) {
return e.some(
(o) => t.toLowerCase().endsWith(o.toLowerCase())
(n) => t.toLowerCase().endsWith(n.toLowerCase())
);
}
function Se(t) {
const ve = 262, A = /* @__PURE__ */ new Map(), we = /* @__PURE__ */ new Set([
"appcode",
"clion",
"clion64",
"idea",
"idea64",
"phpstorm",
"phpstorm64",
"pycharm",
"pycharm64",
"rubymine",
"rubymine64",
"webstorm",
"webstorm64",
"goland",
"goland64",
"rider",
"rider64"
]);
function Me(t) {
return we.has(t);
}
function Ee(t, e) {
if (e) {
const r = i.resolve(e);
if (b.existsSync(r))
return r;
}
const n = [];
let o = i.dirname(i.resolve(t));
for (; ; ) {
n.push(o);
const r = i.dirname(o);
if (r === o)
break;
o = r;
}
for (const r of [".idea", ".git"]) {
const s = n.find(
(a) => b.existsSync(i.join(a, r))
);
if (s)
return s;
}
return i.dirname(i.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));
for (const n of e)
try {
if (b.existsSync(n))
return b.realpathSync(n);
} catch (o) {
}
return null;
}
function Ie(t) {
const e = i.dirname(t);
return [
// macOS: <IDE>.app/Contents/MacOS/<launcher>
i.resolve(e, "../Resources/product-info.json"),
// Linux/Windows: <IDE>/bin/<launcher>
i.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 = A.get(t);
if (e !== void 0)
return e;
const n = Pe(t);
if (!n)
return A.set(t, !1), !1;
for (const o of Ie(n))
try {
const r = JSON.parse(
b.readFileSync(o, "utf8")
), s = Ne(r);
return A.set(t, s), s;
} catch (r) {
}
return A.set(t, !1), !1;
}
function Te(t) {
switch (t) {

@@ -499,4 +597,4 @@ case "vim":

}
function be(t) {
const e = j(
function Be(t) {
const e = U(
"CODE_INSPECTOR_FORMAT_PATH",

@@ -508,3 +606,3 @@ t

return JSON.parse(e);
} catch (o) {
} catch (n) {
return null;

@@ -514,46 +612,65 @@ }

}
function $(t, e) {
function Ae(t, e) {
console.log(
m.red("Could not open " + f.basename(t) + " in the editor.")
C.red("Could not open " + i.basename(t) + " in the editor.")
), e && (e[e.length - 1] !== "." && (e += "."), console.log(
m.red("The editor process exited with an error: " + e)
C.red("The editor process exited with an error: " + e)
)), console.log(
"To set up the editor integration, add something like " + m.cyan("CODE_EDITOR=code") + " to the " + m.green(".env.local") + " file in your project folder, or add " + m.green('editor: "code"') + " to CodeInspectorPlugin config, and then restart the development server. Learn more: " + m.green("https://goo.gl/MMTaZt")
"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 x = null;
function Oe(t) {
let O = null;
function De(t) {
return t === "reuse" ? "-r" : t === "new" ? "-n" : "";
}
function Pe(t) {
function j(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, {
// @ts-ignore
shell: !0,
env: n
});
}
return I.spawn(t, e, {
stdio: "ignore",
env: n
});
}
function ze(t) {
let {
file: e,
line: o = 1,
column: n = 1,
editor: s,
method: r,
format: i,
line: n = 1,
column: o = 1,
editor: r,
method: s,
format: a,
onError: c,
rootDir: y,
usePid: v,
type: P = "exec"
usePid: w,
type: N = "exec"
} = t;
if (!T.existsSync(e))
if (!b.existsSync(e))
return;
let [C, ...b] = ie(s, y, v);
const M = be(y || "") || i;
if (!C || C.toLowerCase() === "none") {
let [h, ...g] = fe(r, y, w);
const M = g.filter((d) => d !== null);
let l = null;
const S = Be(y || "") || a;
if (!h || h.toLowerCase() === "none") {
typeof c == "function" ? c(e, "Failed to recognize IDE automatically") : console.log(
"Failed to recognize IDE automatically, add something like " + m.cyan("CODE_EDITOR=code") + " to the " + m.green(".env.local") + " file in your project folder, or add " + m.green('editor: "code"') + " to CodeInspectorPlugin config, and then restart the development server. Learn more: " + m.green("https://goo.gl/MMTaZt")
"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 d = re(
C
const E = h, u = de(
h
);
if ((P === "open" || P === "open-bg") && process.platform === "darwin" && B[d]) {
const a = "".concat(B[d], "://file").concat(e, ":").concat(o, ":").concat(n), h = P === "open-bg" ? ["-g", a] : [a];
x = w.spawn("open", h, {
if ((N === "open" || N === "open-bg") && process.platform === "darwin" && W[u]) {
const d = "".concat(W[u], "://file").concat(e, ":").concat(n, ":").concat(o), p = N === "open-bg" ? ["-g", d] : [d];
O = I.spawn("open", p, {
stdio: "ignore",
env: I(S({}, process.env), {
env: B(v({}, process.env), {
NODE_OPTIONS: ""

@@ -563,43 +680,49 @@ })

} else {
process.platform === "linux" && e.startsWith("/mnt/") && /Microsoft/i.test(Z.release()) && (e = f.relative("", e));
let a = null;
if (o ? b = b.concat(
ne({
editorBasename: d,
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([
e,
"--line",
String(n),
"--column",
String(o)
])), g = g.concat(
le({
editorBasename: u,
fileName: e,
lineNumber: o,
colNumber: n,
workspace: a,
openWindowParams: Oe(r),
pathFormat: M
lineNumber: n,
colNumber: o,
workspace: p,
openWindowParams: De(s),
pathFormat: S
})
) : b.push(e), x && Se(C) && x.kill("SIGKILL"), process.platform === "win32") {
const h = (l) => l.replace(/([&|<>,;=^])/g, "^$1"), O = (l) => l.includes("^") ? '^"'.concat(l, '^"') : l.includes(" ") ? '"'.concat(l, '"') : l, E = [C, ...b.map(h)].map(O).join(" ");
x = w.exec(E, {
stdio: "ignore",
// @ts-ignore
shell: !0,
env: I(S({}, process.env), {
NODE_OPTIONS: ""
})
});
} else
x = w.spawn(C, b, {
stdio: "ignore",
env: I(S({}, process.env), {
NODE_OPTIONS: ""
})
});
)) : g.push(e), O && Te(h) && O.kill("SIGKILL"), O = j(h, g);
}
x.on("exit", function(a) {
x = null, a && (typeof c == "function" ? c(e, "(code " + a + ")") : $(e, "(code " + a + ")"));
}), x.on("error", function(a) {
typeof c == "function" ? c(e, a.message) : $(e, a.message);
});
const P = (d) => {
typeof c == "function" ? c(e, d) : Ae(e, d);
}, _ = (d) => {
let p = !1;
const k = (T) => {
if (!p) {
if (p = !0, l) {
const Z = l;
l = null, O = j(E, Z), _(O);
return;
}
P(T);
}
};
d.on("exit", function(T) {
O === d && (O = null), T ? k("(code " + T + ")") : p = !0;
}), d.on("error", function(T) {
k(T.message);
});
};
_(O);
}
export {
te as formatOpenPath,
j as getEnvVariable,
ae as getEnvVariables,
Pe as launchIDE
ie as formatOpenPath,
U as getEnvVariable,
pe as getEnvVariables,
ze as launchIDE
};
{
"name": "launch-ide",
"version": "1.4.5",
"version": "1.4.6",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "module": "./dist/index.mjs",