@jsjoeio/code-server
Version:
Run VS Code on a remote server.
4 lines (2 loc) • 1.77 kB
JavaScript
;function setupCurrentWorkingDirectory(){const o=require("path");try{let e=process.env.VSCODE_CWD;typeof e!="string"&&(e=process.cwd(),process.env.VSCODE_CWD=e),process.platform==="win32"?process.chdir(o.dirname(process.execPath)):e!==process.cwd()&&process.chdir(e)}catch(e){console.error(e)}}setupCurrentWorkingDirectory(),exports.injectNodeModuleLookupPath=function(o){if(!o)throw new Error("Missing injectPath");const e=require("module"),a=require("path").join(__dirname,"../node_modules"),l=e._resolveLookupPaths;e._resolveLookupPaths=function(s,r){const n=l(s,r);if(Array.isArray(n)){for(let i=0,p=n.length;i<p;i++)if(n[i]===a){n.splice(i,0,o);break}}return n}},exports.removeGlobalNodeModuleLookupPaths=function(){const o=require("module"),e=o.globalPaths,c=o._resolveLookupPaths;o._resolveLookupPaths=function(a,l){const s=c(a,l);let r=0;for(;r<s.length&&s[s.length-1-r]===e[e.length-1-r];)r++;return s.slice(0,s.length-r)}},exports.configurePortable=function(o){const e=require("fs"),c=require("path"),a=c.dirname(__dirname);function l(t){return process.env.VSCODE_DEV?a:process.platform==="darwin"?t.dirname(t.dirname(t.dirname(a))):t.dirname(t.dirname(a))}function s(t){if(process.env.VSCODE_PORTABLE)return process.env.VSCODE_PORTABLE;if(process.platform==="win32"||process.platform==="linux")return t.join(l(t),"data");const u=o.portable||`${o.applicationName}-portable-data`;return t.join(t.dirname(l(t)),u)}const r=s(c),n=!("target"in o)&&e.existsSync(r),i=c.join(r,"tmp"),p=n&&e.existsSync(i);return n?process.env.VSCODE_PORTABLE=r:delete process.env.VSCODE_PORTABLE,p&&(process.platform==="win32"?(process.env.TMP=i,process.env.TEMP=i):process.env.TMPDIR=i),{portableDataPath:r,isPortable:n}};
//# sourceMappingURL=bootstrap-node.js.map