Comparing version 1.0.0-beta.0 to 1.0.0
@@ -1,1 +0,1 @@ | ||
"use strict";var R=Object.defineProperty,N=Object.defineProperties;var k=Object.getOwnPropertyDescriptors;var P=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var D=(t,e,o)=>e in t?R(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,v=(t,e)=>{for(var o in e||(e={}))F.call(e,o)&&D(t,o,e[o]);if(P)for(var o of P(e))H.call(e,o)&&D(t,o,e[o]);return t},T=(t,e)=>N(t,k(e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("fs"),f=require("path"),g=require("child_process"),$=require("os"),u=require("chalk"),B=require("dotenv"),L={"/Cursor.app/Contents/MacOS/Cursor":"/Cursor.app/Contents/MacOS/Cursor","/Visual Studio Code.app/Contents/MacOS/Electron":"/Visual Studio Code.app/Contents/MacOS/Electron","/Visual Studio Code - Insiders.app/Contents/MacOS/Electron":"/Visual Studio Code - Insiders.app/Contents/MacOS/Electron","/VSCodium.app/Contents/MacOS/Electron":"/VSCodium.app/Contents/MacOS/Electron","/WebStorm.app/Contents/MacOS/webstorm":"/WebStorm.app/Contents/MacOS/webstorm","/HBuilderX.app/Contents/MacOS/HBuilderX":"/HBuilderX.app/Contents/MacOS/HBuilderX","/Atom.app/Contents/MacOS/Atom":"atom","/Atom Beta.app/Contents/MacOS/Atom Beta":"/Atom Beta.app/Contents/MacOS/Atom Beta","/Brackets.app/Contents/MacOS/Brackets":"brackets","/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","/PhpStorm.app/Contents/MacOS/phpstorm":"/PhpStorm.app/Contents/MacOS/phpstorm","/PyCharm.app/Contents/MacOS/pycharm":"/PyCharm.app/Contents/MacOS/pycharm","/PyCharm CE.app/Contents/MacOS/pycharm":"/PyCharm CE.app/Contents/MacOS/pycharm","/IntelliJ IDEA.app/Contents/MacOS/idea":"/IntelliJ IDEA.app/Contents/MacOS/idea","/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea":"/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea","/IntelliJ IDEA Community Edition.app/Contents/MacOS/idea":"/IntelliJ IDEA Community Edition.app/Contents/MacOS/idea","/Zed.app/Contents/MacOS/zed":"zed","/GoLand.app/Contents/MacOS/goland":"/GoLand.app/Contents/MacOS/goland","/AppCode.app/Contents/MacOS/appcode":"/AppCode.app/Contents/MacOS/appcode","/CLion.app/Contents/MacOS/clion":"/CLion.app/Contents/MacOS/clion","/RubyMine.app/Contents/MacOS/rubymine":"/RubyMine.app/Contents/MacOS/rubymine","/MacVim.app/Contents/MacOS/MacVim":"mvim","/Rider.app/Contents/MacOS/rider":"/Rider.app/Contents/MacOS/rider"},V={code:["/Visual Studio Code.app/Contents/MacOS/Electron"],"code-insiders":["/Visual Studio Code - Insiders.app/Contents/MacOS/Electron"],webstorm:["/WebStorm.app/Contents/MacOS/webstorm"],cursor:["/Cursor.app/Contents/MacOS/Cursor"],atom:["/Atom.app/Contents/MacOS/Atom"],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"]},W={cursor:"cursor",code:"code",vscodium:"vscodium",codium:"codium",webstorm:"webstorm","webstorm.sh":"webstorm",hbuilderx:"hbuilderx","hbuilderx.sh":"hbuilderx",atom:"atom",Brackets:"brackets","code-insiders":"code-insiders",emacs:"emacs",gvim:"gvim",idea:"idea","idea.sh":"idea",phpstorm:"phpstorm","phpstorm.sh":"phpstorm",pycharm:"pycharm","pycharm.sh":"pycharm",rubymine:"rubymine","rubymine.sh":"rubymine",sublime_text:"subl",vim:"vim",goland:"goland","goland.sh":"goland",rider:"rider","rider.sh":"rider"},X={code:["code"],"code-insiders":["code-insiders"],webstorm:["webstorm.sh"],cursor:["cursor"],atom:["atom"],hbuilder:["hbuilderx"],phpstorm:["phpstorm.sh"],pycharm:["pycharm.sh"],idea:["idea.sh"],codium:["vscodium"],goland:["goland"],brackets:["Brackets"],rider:["rider"],rubymine:["rubymine.sh"],sublime:["sublime_text"],vim:["vim"],emacs:["emacs"]},J={"Cursor.exe":"","Code.exe":"","Code - Insiders.exe":"","VSCodium.exe":"","webstorm.exe":"","webstorm64.exe":"","HBuilderX.exe":"","HBuilderX64.exe":"","HBuilder.exe":"","HBuilder64.exe":"","Brackets.exe":"","atom.exe":"","sublime_text.exe":"","notepad++.exe":"","clion.exe":"","clion64.exe":"","idea.exe":"","idea64.exe":"","phpstorm.exe":"","phpstorm64.exe":"","pycharm.exe":"","pycharm64.exe":"","rubymine.exe":"","rubymine64.exe":"","goland.exe":"","goland64.exe":"","rider.exe":"","rider64.exe":""},j={code:["Code.exe"],"code-insiders":["Code - Insiders.exe"],webstorm:["webstorm.exe","webstorm64.exe"],cursor:["Cursor.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"]},z={darwin:L,linux:W,win32:J},I={darwin:V,linux:X,win32:j},d="{file}",m="{line}",x="{column}";function q(t,e,o,n){let r="".concat(t,":").concat(e,":").concat(o);if(typeof n=="string")r=n.replace(d,t).replace(m,e.toString()).replace(x,o.toString());else if(n instanceof Array)return n.map(a=>a.replace(d,t).replace(m,e.toString()).replace(x,o.toString()));return[r]}function U(t){const{processName:e,fileName:o,lineNumber:n,colNumber:r,workspace:a,openWindowParams:h,pathFormat:i}=t,l={editorBasename:G(e),openWindowParams:h,workspace:a},M=Z(l)||"{file}";return q(o,n,r,i||M)}function G(t){let e=f.basename(t).replace(/\.(exe|cmd|bat|sh)$/i,"");const o=process.platform,n=Object.keys(I[o]);for(let r=0;r<n.length;r++)if((I[o][n[r]]||[]).some(h=>t.endsWith(h))){e=n[r];break}return e.toLowerCase()}function Z(t){const{editorBasename:e,openWindowParams:o,workspace:n}=t;switch(e){case"atom":case"atom beta":case"subl":case"sublime":case"sublime_text":case"wstorm":case"charm":case"zed":return"".concat(d,":").concat(m,":").concat(x);case"notepad++":return["-n"+m,"-c"+x,d];case"vim":case"mvim":return["+call cursor(".concat(m,", ").concat(x,")"),d];case"joe":case"gvim":return["+"+m,d];case"emacs":case"emacsclient":return["+"+m+":"+x,d];case"rmate":case"mate":case"mine":return["--line",m,d];case"code":case"code-insiders":case"code - insiders":case"codium":case"cursor":case"vscodium":case"hbuilderx":case"hbuilder":return[...n?[n]:[],"-g",...o?[o]:[],"".concat(d,":").concat(m,":").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[...n?[n]:[],"--line",m,d]}return""}const Q={darwin:"ps ax -o comm=",linux:"ps -eo comm --sort=comm",win32:'wmic process where "executablepath is not null" get executablepath'},K='powershell -NoProfile -Command "Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }"';function Y(t){let e=null;if(process.env.CODE_EDITOR){const n=w(process.env.CODE_EDITOR);if(n)e=n;else return[process.env.CODE_EDITOR]}const o=f.resolve(process.cwd(),".env.local");if(E.existsSync(o)&&!e){const n=E.readFileSync(o,"utf-8"),r=B.parse(n||"");if(r.CODE_EDITOR){const a=w(r.CODE_EDITOR);if(a)e=a;else return[r.CODE_EDITOR]}}if(t&&!e){const n=w(t);n&&(e=n)}try{let n;const r=process.platform,a=process.platform==="win32",h=Q[r],i=z[r];ee(a);let p="";try{p=g.execSync(h,{encoding:"utf-8"})}catch(S){a&&(p=g.execSync(K,{encoding:"utf-8"}))}const l=Object.keys(i),M=p.split(a?"\r\n":"\n").map(S=>S.trim());for(let S=0;S<l.length;S++){const s=l[S];let C="",O="";if(a){const c=M.find(y=>f.basename(y)===s);c&&(O=f.basename(c),C=c)}else if(r==="darwin"){const c=M.find(y=>y.endsWith(s));if(c){const y=c.replace(s,""),_=i[s];O=s,_.includes("/")?C="".concat(y).concat(_):C=_}}else p.indexOf(s)!==-1&&(O=s,C=i[s]);if(O&&C){if(e!=null&&e.includes(O))return[C];n||(n=[C])}}if(n)return n}catch(n){}return process.env.VISUAL?[process.env.VISUAL]:process.env.EDITOR?[process.env.EDITOR]:[null]}const w=t=>{const e=process.platform;return I[e]&&I[e][t]||null},ee=t=>{if(t)try{g.execSync("chcp 65001")}catch(e){}};function te(t){switch(t){case"vim":case"emacs":case"nano":return!0}return!1}function ne(){if(process.env.CODE_INSPECTOR_FORMAT_PATH)try{return JSON.parse(process.env.CODE_INSPECTOR_FORMAT_PATH)}catch(e){return null}const t=f.resolve(process.cwd(),".env.local");if(E.existsSync(t)){const e=E.readFileSync(t,"utf-8"),o=B.parse(e||"");if(o.CODE_INSPECTOR_FORMAT_PATH)try{return JSON.parse(o.CODE_INSPECTOR_FORMAT_PATH)}catch(n){return null}}return null}function A(t,e){console.log(u.red("Could not open "+f.basename(t)+" in the editor.")),e&&(e[e.length-1]!=="."&&(e+="."),console.log(u.red("The editor process exited with an error: "+e))),console.log("To set up the editor integration, add something like "+u.cyan("CODE_EDITOR=code")+" to the "+u.green(".env.local")+" file in your project folder, or add "+u.green('editor: "code"')+" to CodeInspectorPlugin config, and then restart the development server. Learn more: "+u.green("https://goo.gl/MMTaZt"))}let b=null;function oe(t){return t==="reuse"?"-r":t==="new"?"-n":""}function re(t){let{file:e,line:o=1,column:n=1,editor:r,method:a,format:h,onError:i}=t;if(!E.existsSync(e))return;let[p,...l]=Y(r);const M=ne()||h;if(!p||p.toLowerCase()==="none"){typeof i=="function"?i(e,"Failed to recognize IDE automatically"):console.log("Failed to recognize IDE automatically, add something like "+u.cyan("CODE_EDITOR=code")+" to the "+u.green(".env.local")+" file in your project folder, or add "+u.green('editor: "code"')+" to CodeInspectorPlugin config, and then restart the development server. Learn more: "+u.green("https://goo.gl/MMTaZt"));return}process.platform==="linux"&&e.startsWith("/mnt/")&&/Microsoft/i.test($.release())&&(e=f.relative("",e));let S=null;if(o?l=l.concat(U({processName:p,fileName:e,lineNumber:o,colNumber:n,workspace:S,openWindowParams:oe(a),pathFormat:M})):l.push(e),b&&te(p)&&b.kill("SIGKILL"),process.platform==="win32"){const s=c=>c.replace(/([&|<>,;=^])/g,"^$1"),C=c=>c.includes("^")?'^"'.concat(c,'^"'):c.includes(" ")?'"'.concat(c,'"'):c,O=[p,...l.map(s)].map(C).join(" ");b=g.exec(O,{stdio:"inherit",shell:!0,env:T(v({},process.env),{NODE_OPTIONS:""})})}else b=g.spawn(p,l,{stdio:"inherit",env:T(v({},process.env),{NODE_OPTIONS:""})});b.on("exit",function(s){b=null,s&&(typeof i=="function"?i(e,"(code "+s+")"):A(e,"(code "+s+")"))}),b.on("error",function(s){typeof i=="function"?i(e,s.message):A(e,s.message)})}exports.launchIDE=re; | ||
"use strict";var N=Object.defineProperty,k=Object.defineProperties;var F=Object.getOwnPropertyDescriptors;var w=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var D=(t,e,o)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,v=(t,e)=>{for(var o in e||(e={}))H.call(e,o)&&D(t,o,e[o]);if(w)for(var o of w(e))$.call(e,o)&&D(t,o,e[o]);return t},P=(t,e)=>k(t,F(e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("fs"),f=require("path"),g=require("child_process"),L=require("os"),u=require("chalk"),B=require("dotenv"),V={"/Cursor.app/Contents/MacOS/Cursor":"/Cursor.app/Contents/MacOS/Cursor","/Visual Studio Code.app/Contents/MacOS/Electron":"/Visual Studio Code.app/Contents/MacOS/Electron","/Visual Studio Code - Insiders.app/Contents/MacOS/Electron":"/Visual Studio Code - Insiders.app/Contents/MacOS/Electron","/VSCodium.app/Contents/MacOS/Electron":"/VSCodium.app/Contents/MacOS/Electron","/WebStorm.app/Contents/MacOS/webstorm":"/WebStorm.app/Contents/MacOS/webstorm","/HBuilderX.app/Contents/MacOS/HBuilderX":"/HBuilderX.app/Contents/MacOS/HBuilderX","/Atom.app/Contents/MacOS/Atom":"atom","/Atom Beta.app/Contents/MacOS/Atom Beta":"/Atom Beta.app/Contents/MacOS/Atom Beta","/Brackets.app/Contents/MacOS/Brackets":"brackets","/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","/PhpStorm.app/Contents/MacOS/phpstorm":"/PhpStorm.app/Contents/MacOS/phpstorm","/PyCharm.app/Contents/MacOS/pycharm":"/PyCharm.app/Contents/MacOS/pycharm","/PyCharm CE.app/Contents/MacOS/pycharm":"/PyCharm CE.app/Contents/MacOS/pycharm","/IntelliJ IDEA.app/Contents/MacOS/idea":"/IntelliJ IDEA.app/Contents/MacOS/idea","/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea":"/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea","/IntelliJ IDEA Community Edition.app/Contents/MacOS/idea":"/IntelliJ IDEA Community Edition.app/Contents/MacOS/idea","/Zed.app/Contents/MacOS/zed":"zed","/GoLand.app/Contents/MacOS/goland":"/GoLand.app/Contents/MacOS/goland","/AppCode.app/Contents/MacOS/appcode":"/AppCode.app/Contents/MacOS/appcode","/CLion.app/Contents/MacOS/clion":"/CLion.app/Contents/MacOS/clion","/RubyMine.app/Contents/MacOS/rubymine":"/RubyMine.app/Contents/MacOS/rubymine","/MacVim.app/Contents/MacOS/MacVim":"mvim","/Rider.app/Contents/MacOS/rider":"/Rider.app/Contents/MacOS/rider"},W={code:["/Visual Studio Code.app/Contents/MacOS/Electron"],"code-insiders":["/Visual Studio Code - Insiders.app/Contents/MacOS/Electron"],webstorm:["/WebStorm.app/Contents/MacOS/webstorm"],cursor:["/Cursor.app/Contents/MacOS/Cursor"],atom:["/Atom.app/Contents/MacOS/Atom"],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"]},X={cursor:"cursor",code:"code",vscodium:"vscodium",codium:"codium",webstorm:"webstorm","webstorm.sh":"webstorm",hbuilderx:"hbuilderx","hbuilderx.sh":"hbuilderx",atom:"atom",Brackets:"brackets","code-insiders":"code-insiders",emacs:"emacs",gvim:"gvim",idea:"idea","idea.sh":"idea",phpstorm:"phpstorm","phpstorm.sh":"phpstorm",pycharm:"pycharm","pycharm.sh":"pycharm",rubymine:"rubymine","rubymine.sh":"rubymine",sublime_text:"subl",vim:"vim",goland:"goland","goland.sh":"goland",rider:"rider","rider.sh":"rider"},J={code:["code"],"code-insiders":["code-insiders"],webstorm:["webstorm.sh"],cursor:["cursor"],atom:["atom"],hbuilder:["hbuilderx"],phpstorm:["phpstorm.sh"],pycharm:["pycharm.sh"],idea:["idea.sh"],codium:["vscodium"],goland:["goland"],brackets:["Brackets"],rider:["rider"],rubymine:["rubymine.sh"],sublime:["sublime_text"],vim:["vim"],emacs:["emacs"]},j={"Cursor.exe":"","Code.exe":"","Code - Insiders.exe":"","VSCodium.exe":"","webstorm.exe":"","webstorm64.exe":"","HBuilderX.exe":"","HBuilderX64.exe":"","HBuilder.exe":"","HBuilder64.exe":"","Brackets.exe":"","atom.exe":"","sublime_text.exe":"","notepad++.exe":"","clion.exe":"","clion64.exe":"","idea.exe":"","idea64.exe":"","phpstorm.exe":"","phpstorm64.exe":"","pycharm.exe":"","pycharm64.exe":"","rubymine.exe":"","rubymine64.exe":"","goland.exe":"","goland64.exe":"","rider.exe":"","rider64.exe":""},z={code:["Code.exe"],"code-insiders":["Code - Insiders.exe"],webstorm:["webstorm.exe","webstorm64.exe"],cursor:["Cursor.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"]},q={darwin:V,linux:X,win32:j},I={darwin:W,linux:J,win32:z},d="{file}",m="{line}",x="{column}";function R(t,e,o,n){let r="".concat(t,":").concat(e,":").concat(o);if(typeof n=="string")r=n.replace(d,t).replace(m,e.toString()).replace(x,o.toString());else if(n instanceof Array)return n.map(a=>a.replace(d,t).replace(m,e.toString()).replace(x,o.toString()));return[r]}function U(t){const{processName:e,fileName:o,lineNumber:n,colNumber:r,workspace:a,openWindowParams:h,pathFormat:i}=t,l={editorBasename:G(e),openWindowParams:h,workspace:a},M=Z(l)||"{file}";return R(o,n,r,i||M)}function G(t){let e=f.basename(t).replace(/\.(exe|cmd|bat|sh)$/i,"");const o=process.platform,n=Object.keys(I[o]);for(let r=0;r<n.length;r++)if((I[o][n[r]]||[]).some(h=>t.endsWith(h))){e=n[r];break}return e.toLowerCase()}function Z(t){const{editorBasename:e,openWindowParams:o,workspace:n}=t;switch(e){case"atom":case"atom beta":case"subl":case"sublime":case"sublime_text":case"wstorm":case"charm":case"zed":return"".concat(d,":").concat(m,":").concat(x);case"notepad++":return["-n"+m,"-c"+x,d];case"vim":case"mvim":return["+call cursor(".concat(m,", ").concat(x,")"),d];case"joe":case"gvim":return["+"+m,d];case"emacs":case"emacsclient":return["+"+m+":"+x,d];case"rmate":case"mate":case"mine":return["--line",m,d];case"code":case"code-insiders":case"code - insiders":case"codium":case"cursor":case"vscodium":case"hbuilderx":case"hbuilder":return[...n?[n]:[],"-g",...o?[o]:[],"".concat(d,":").concat(m,":").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[...n?[n]:[],"--line",m,d]}return""}const Q={darwin:"ps ax -o comm=",linux:"ps -eo comm --sort=comm",win32:'wmic process where "executablepath is not null" get executablepath'},K='powershell -NoProfile -Command "Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }"';function Y(t){let e=null;if(process.env.CODE_EDITOR){const n=T(process.env.CODE_EDITOR);if(n)e=n;else return[process.env.CODE_EDITOR]}const o=f.resolve(process.cwd(),".env.local");if(E.existsSync(o)&&!e){const n=E.readFileSync(o,"utf-8"),r=B.parse(n||"");if(r.CODE_EDITOR){const a=T(r.CODE_EDITOR);if(a)e=a;else return[r.CODE_EDITOR]}}if(t&&!e){const n=T(t);n&&(e=n)}try{let n;const r=process.platform,a=process.platform==="win32",h=Q[r],i=q[r];ee(a);let p="";try{p=g.execSync(h,{encoding:"utf-8"})}catch(S){a&&(p=g.execSync(K,{encoding:"utf-8"}))}const l=Object.keys(i),M=p.split(a?"\r\n":"\n").map(S=>S.trim());for(let S=0;S<l.length;S++){const s=l[S];let C="",O="";if(a){const c=M.find(y=>f.basename(y)===s);c&&(O=f.basename(c),C=c)}else if(r==="darwin"){const c=M.find(y=>y.endsWith(s));if(c){const y=c.replace(s,""),_=i[s];O=s,_.includes("/")?C="".concat(y).concat(_):C=_}}else p.indexOf(s)!==-1&&(O=s,C=i[s]);if(O&&C){if(e!=null&&e.includes(O))return[C];n||(n=[C])}}if(n)return n}catch(n){}return process.env.VISUAL?[process.env.VISUAL]:process.env.EDITOR?[process.env.EDITOR]:[null]}const T=t=>{const e=process.platform;return I[e]&&I[e][t]||null},ee=t=>{if(t)try{g.execSync("chcp 65001")}catch(e){}};function te(t){switch(t){case"vim":case"emacs":case"nano":return!0}return!1}function ne(){if(process.env.CODE_INSPECTOR_FORMAT_PATH)try{return JSON.parse(process.env.CODE_INSPECTOR_FORMAT_PATH)}catch(e){return null}const t=f.resolve(process.cwd(),".env.local");if(E.existsSync(t)){const e=E.readFileSync(t,"utf-8"),o=B.parse(e||"");if(o.CODE_INSPECTOR_FORMAT_PATH)try{return JSON.parse(o.CODE_INSPECTOR_FORMAT_PATH)}catch(n){return null}}return null}function A(t,e){console.log(u.red("Could not open "+f.basename(t)+" in the editor.")),e&&(e[e.length-1]!=="."&&(e+="."),console.log(u.red("The editor process exited with an error: "+e))),console.log("To set up the editor integration, add something like "+u.cyan("CODE_EDITOR=code")+" to the "+u.green(".env.local")+" file in your project folder, or add "+u.green('editor: "code"')+" to CodeInspectorPlugin config, and then restart the development server. Learn more: "+u.green("https://goo.gl/MMTaZt"))}let b=null;function oe(t){return t==="reuse"?"-r":t==="new"?"-n":""}function re(t){let{file:e,line:o=1,column:n=1,editor:r,method:a,format:h,onError:i}=t;if(!E.existsSync(e))return;let[p,...l]=Y(r);const M=ne()||h;if(!p||p.toLowerCase()==="none"){typeof i=="function"?i(e,"Failed to recognize IDE automatically"):console.log("Failed to recognize IDE automatically, add something like "+u.cyan("CODE_EDITOR=code")+" to the "+u.green(".env.local")+" file in your project folder, or add "+u.green('editor: "code"')+" to CodeInspectorPlugin config, and then restart the development server. Learn more: "+u.green("https://goo.gl/MMTaZt"));return}process.platform==="linux"&&e.startsWith("/mnt/")&&/Microsoft/i.test(L.release())&&(e=f.relative("",e));let S=null;if(o?l=l.concat(U({processName:p,fileName:e,lineNumber:o,colNumber:n,workspace:S,openWindowParams:oe(a),pathFormat:M})):l.push(e),b&&te(p)&&b.kill("SIGKILL"),process.platform==="win32"){const s=c=>c.replace(/([&|<>,;=^])/g,"^$1"),C=c=>c.includes("^")?'^"'.concat(c,'^"'):c.includes(" ")?'"'.concat(c,'"'):c,O=[p,...l.map(s)].map(C).join(" ");b=g.exec(O,{stdio:"inherit",shell:!0,env:P(v({},process.env),{NODE_OPTIONS:""})})}else b=g.spawn(p,l,{stdio:"inherit",env:P(v({},process.env),{NODE_OPTIONS:""})});b.on("exit",function(s){b=null,s&&(typeof i=="function"?i(e,"(code "+s+")"):A(e,"(code "+s+")"))}),b.on("error",function(s){typeof i=="function"?i(e,s.message):A(e,s.message)})}exports.formatOpenPath=R;exports.launchIDE=re; |
{ | ||
"name": "launch-ide", | ||
"version": "1.0.0-beta.0", | ||
"version": "1.0.0", | ||
"main": "dist/index.js", | ||
@@ -26,3 +26,3 @@ "module": "./dist/index.mjs", | ||
"license": "MIT", | ||
"homepage": "https://inspector.fe-dev.cn/guide/ide.html", | ||
"homepage": "https://github.com/zh-lx/launch-ide#README.md", | ||
"description": "Automatically recognize the editor by running processes and open the specified file in it.", | ||
@@ -29,0 +29,0 @@ "keywords": [ |
@@ -0,1 +1,2 @@ | ||
export declare function formatOpenPath(file: string, line: string | number, column: string | number, format: string | string[] | boolean): string[]; | ||
export declare function getArguments(params: { | ||
@@ -2,0 +3,0 @@ processName: string; |
@@ -13,1 +13,2 @@ import { Editor, IDEOpenMethod } from './type'; | ||
export * from './type'; | ||
export { formatOpenPath } from './get-args'; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
39662
578
1