dsh-code-server-app 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +521 -521
- package/README.md +505 -505
- package/lib/client.js +3 -2
- package/lib/index.js +24 -1
- package/lib/launcher.mjs +433 -362
- package/lib/serve-dsh.mjs +162 -162
- package/package.json +4 -2
- package/vendor/VENDOR.json +1 -1
package/lib/client.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({id:'dsh-code-server-app',factory:function(require){var module={exports:{}};var exports=module.exports;
|
|
2
|
-
var R=Object.defineProperty;var fe=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var ve=Object.prototype.hasOwnProperty;var he=(e,r)=>{for(var t in r)R(e,t,{get:r[t],enumerable:!0})},be=(e,r,t,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of pe(r))!ve.call(e,a)&&a!==t&&R(e,a,{get:()=>r[a],enumerable:!(l=fe(r,a))||l.enumerable});return e};var ge=e=>be(R({},"__esModule",{value:!0}),e);var tr={};he(tr,{apply:()=>qe,inject:()=>er,name:()=>rr});module.exports=ge(tr);var Q="dsh-resource://file/",me="sidebar://",Y="session";function I(e){return typeof e=="string"&&e.startsWith(me)}function M(e){if(typeof e!="string"||!e.startsWith(Q))return null;for(var r=e.length,t=0;t<e.length;t+=1){var l=e.charAt(t);if(l==="?"||l==="#"){r=t;break}}var a=e.slice(Q.length,r).split("/"),s=a.shift();try{if(s==="session"){var d=a.shift();return d===void 0||d===""||a.length===0?null:{scope:"session",sessionId:decodeURIComponent(d),path:W(a)}}if(s==="absolute"){var f=a[0]===""&&a.length>1,p=f?a.slice(1):a,o=W(p);return(o===""||o.charAt(0)==="/")&&!f?null:f?{scope:"absolute",path:"//"+o}:o===""?null:{scope:"absolute",path:Z(o)?o:"/"+o}}}catch(c){return null}return null}function W(e){for(var r=[],t=0;t<e.length;t+=1)r.push(decodeURIComponent(e[t]));return r.join("/")}function Z(e){return/^[A-Za-z]:($|\/)/.test(e)}function ye(e){return typeof e!="string"||e===""?!1:e.charAt(0)==="/"?!0:Z(e)}function J(e){var r=M(e);if(r===null)return"";var t=r.path.replace(/[/\\]+$/,""),l=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\")),a=l===-1?t:t.slice(l+1);return a}function V(e,r){if(e===null||e==null)return null;var t=typeof e.path=="string"?e.path:"";if(t==="")return null;if(ye(t))return t;if(typeof r!="string"||r==="")return null;var l=r.indexOf("\\")!==-1?"\\":"/",a=r.replace(/[\\/]+$/,"");return a+l+(l==="\\"?t.replace(/\//g,"\\"):t)}function X(e,r){return e===null||e==null?!1:e.scope==="session"?!0:r==="all"}var N=typeof Element!="undefined"&&typeof Element.prototype.moveBefore=="function",we=-2e4,n={park:null,frame:null,currentSrc:null,sameOrigin:null,owner:null,lastRect:null,parkStrategy:"offscreen",degraded:!1,preloaded:!1,nudgeCount:0,nudgeEnabled:!0,lastNudgeAt:0,listeners:new Set};function D(){return{ready:n.frame!==null,docked:n.owner!==null,owner:n.owner,src:n.currentSrc,sameOrigin:n.sameOrigin,parkStrategy:n.parkStrategy,degraded:n.degraded,preloaded:n.preloaded,supportsMoveBefore:N,nudgeCount:n.nudgeCount,lastNudgeAt:n.lastNudgeAt}}function O(){var e=D();n.listeners.forEach(function(r){try{r(e)}catch(t){}})}function K(e){return n.listeners.add(e),function(){n.listeners.delete(e)}}function q(){return D()}function xe(e){e!=="offscreen"&&e!=="behind"||n.parkStrategy!==e&&(n.parkStrategy=e,n.frame!==null&&n.owner===null&&z(),O())}function Se(){return n.parkStrategy}function ke(){var e=n.lastRect;e!==null&&(n.park.style.width=Math.max(1,Math.round(e.width))+"px",n.park.style.height=Math.max(1,Math.round(e.height))+"px")}function z(){if(n.park!==null){if(ke(),n.parkStrategy==="behind"&&n.lastRect!==null){n.park.style.left=Math.round(n.lastRect.left)+"px",n.park.style.top=Math.round(n.lastRect.top)+"px",n.park.style.visibility="visible",n.park.style.zIndex="0";return}n.park.style.left=we+"px",n.park.style.top="0px",n.park.style.visibility="hidden",n.park.style.zIndex="0"}}function $(){n.frame!==null&&(n.frame.setAttribute("inert",""),n.frame.setAttribute("aria-hidden","true"))}function Ee(){n.frame!==null&&(n.frame.removeAttribute("inert"),n.frame.removeAttribute("aria-hidden"))}function Ce(){var e=document.createElement("div");e.className="dshcs-park",e.setAttribute("data-dshcs-park",""),e.setAttribute("aria-hidden","true");var r=document.createElement("iframe");return r.className="dshcs-frame",r.setAttribute("title","code-server"),r.setAttribute("allow","clipboard-read; clipboard-write"),r.setAttribute("data-dshcs-resident",""),r.src="about:blank",e.appendChild(r),document.body.appendChild(e),n.park=e,n.frame=r,n.currentSrc="about:blank",n.owner=null,z(),$(),r}function Ne(e){var r=n.frame;if(r!==null){var t=n.sameOrigin!==e;!t&&r.hasAttribute("data-dshcs-attrs")||(e===!0?r.removeAttribute("sandbox"):e===!1&&r.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms allow-modals allow-popups allow-pointer-lock allow-clipboard-read allow-clipboard-write"),r.setAttribute("data-dshcs-attrs",e===!0?"same-origin":"cross-origin"),n.sameOrigin=e)}}function j(e){var r=e||{};return n.frame===null&&Ce(),typeof r.sameOrigin=="boolean"&&Ne(r.sameOrigin),typeof r.src=="string"&&r.src!==""&&r.src!==n.currentSrc&&Oe(r.src),n.frame}function Oe(e){n.frame===null||typeof e!="string"||e===""||e===n.currentSrc||(n.currentSrc=e,n.frame.src=e,O())}function ee(){var e=n.frame;if(n.nudgeEnabled!==!0||e===null||e.isConnected!==!0)return!1;var r=e.style.display;return e.style.display="none",e.offsetHeight,e.style.display=r,n.nudgeCount+=1,n.lastNudgeAt=Date.now(),!0}function Le(e){return n.nudgeEnabled=e!==!1,n.nudgeEnabled}function re(e){if(n.frame!==null){if(N)try{e.moveBefore(n.frame,null);return}catch(r){n.degraded=!0,n.lastMoveError=(r&&r.name?r.name+": ":"")+(r&&r.message?r.message:String(r))}else n.degraded=!0;e.appendChild(n.frame)}}function P(e,r){if(!(n.frame===null||e==null)){var t=n.owner===null,l=e.getBoundingClientRect();l.width>=1&&l.height>=1&&(n.lastRect={left:l.left,top:l.top,width:l.width,height:l.height}),n.owner=r===void 0?null:r,Ee(),n.park.setAttribute("aria-hidden","true"),re(e),t&&ee(),O()}}function L(e){n.frame!==null&&(e!==void 0&&n.owner!==e||(n.owner=null,z(),$(),n.park.setAttribute("aria-hidden","true"),re(n.park),O()))}function H(e){var r=e||{};return j(r),n.owner===null&&(typeof r.src=="string"&&r.src!==""&&(n.preloaded=!0),L()),n.frame}function Ae(){n.park!==null&&n.park.parentNode!==null&&n.park.parentNode.removeChild(n.park),n.park=null,n.frame=null,n.currentSrc=null,n.sameOrigin=null,n.owner=null,n.lastRect=null,n.degraded=!1,n.preloaded=!1,n.nudgeCount=0,n.lastNudgeAt=0,O()}typeof window!="undefined"&&(window.__dshcsSurface={snapshot:D,setParkStrategy:xe,getParkStrategy:Se,preload:H,dock:P,park:L,nudge:ee,setNudgeEnabled:Le,destroy:Ae});var i=require("react"),_=new Set,A={status:null,busy:!1,sidebarUi:"unknown",sidebarRegisterFailed:!1};function C(e){A=Object.assign({},A,e),_.forEach(function(r){r()})}function Me(e){return _.add(e),function(){_.delete(e)}}function Te(){return A}function B(){return i.useSyncExternalStore(Me,Te)}var Re="/api",Ie="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMTQ3IDE0NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8c3R5bGU+QG1lZGlhIChwcmVmZXJzLWNvbG9yLXNjaGVtZTogZGFyaykgeyogeyBmaWxsOiB3aGl0ZTsgfX08L3N0eWxlPgogIDxwYXRoIGQ9Im00Mi40MjE0LDM5LjY1NWMtMjQuNDA1NywwIC00Mi4xNTU0LDEzLjE3MjEgLTQyLjE1NTQsMzMuODQ1YzAsMjAuNTgxNCAxOC40ODkyLDMzLjg0NSA0Mi4xNTU0LDMzLjg0NWMyMy42NjYyLDAgMzguMTgwMywtMTEuNjE3MSAzOC43MzQ5LC0yOC43MjI1bC0yMS4wNzc3LC0wLjQ1NzRjLTAuOTI0NCw5LjMzMDMgLTkuMTA1OSwxNS4xODQ1IC0xNy42NTcyLDE1LjE4NDVjLTExLjc0MDYsMCAtMjAuNDMwNiwtNy41OTIyIC0yMC40MzA2LC0xOS44NDk2YzAsLTEyLjI1NzQgOC42OSwtMTkuOTg2OCAyMC40MzA2LC0yMC4yMTU1YzguNTUxMywtMC4xODMgMTYuOTE3Nyw1Ljk0NTcgMTcuNDcyMywxNS4yNzZsMjEuMDc3NywtMC42NDAzYy0wLjQ2MjIsLTE2LjgzMTEgLTE0LjE0NDIsLTI4LjI2NTIgLTM4LjU1LC0yOC4yNjUyem00OC44NDQ2LDJsNTUuNDY4LDBsMCw2NC4wMzExbC01NS40NjgsMGwwLC02NC4wMzExeiIgY2xpcC1ydWxlPSJldmVub2RkIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz4KPC9zdmc+Cg==";async function E(e,r){var t={method:r===void 0?"GET":"POST",headers:{}};r!==void 0&&(t.headers["content-type"]="application/json",t.body=JSON.stringify(r));var l=await fetch(Re+e,t),a=await l.text(),s=null;try{s=a===""?null:JSON.parse(a)}catch(d){s=null}return l.ok?s!==null?s:{ok:!1,error:"invalid JSON response"}:{ok:!1,error:"HTTP "+l.status+(s!==null&&s.error!==void 0?": "+s.error:"")}}function de(e,r){try{var t=e(function(v){return v}),l=r===null?null:typeof r=="function"?r(function(v){return v}):null,a=t!=null?t.current:void 0;if(a!==void 0&&t!=null&&t.byId!=null){var s=t.byId[a];if(s!=null&&typeof s.cwd=="string"&&s.cwd!=="")return s.cwd}var d=l!=null&&Array.isArray(l.items)?l.items:[];if(a!==void 0)for(var f=0;f<d.length;f++){var p=d[f];if(p.sessionIds!=null&&p.sessionIds.indexOf(a)!==-1&&typeof p.path=="string"&&p.path!=="")return p.path}var o=l!=null?l.recentWorkspaceId:void 0;if(o!==void 0){for(var c=0;c<d.length;c++)if(d[c].workspaceId===o&&typeof d[c].path=="string"&&d[c].path!=="")return d[c].path}if(d.length>0&&typeof d[0].path=="string"&&d[0].path!=="")return d[0].path}catch(v){}}function oe(e,r){if(e==null||typeof e.url!="string"||e.url==="")return null;var t=typeof r=="string"&&r!==""?r:e!=null&&e.cwd!=null?e.cwd:null;if(t==null||t==="")return e.url;var l=t.replace(/\\/g,"/"),a=l;return(/^[A-Za-z]:\//.test(l)||l.charCodeAt(0)!==47)&&(a="/"+l),e.url+"?folder="+encodeURIComponent(a)}function De(e){var r=e.status,t=e.pageUrl,l=e.reloadTick,a=e.owner,s=i.useRef(null),d=r!=null&&r.ok===!0&&r.running===!0,f=r!=null&&r.status==="starting",p=r!=null&&r.ok===!1,o=r!=null&&r.serve==="dsh";if(i.useLayoutEffect(function(){if(!d||t===null){L(a);return}j({src:t,sameOrigin:o}),s.current!==null&&P(s.current,a)},[d,t,o,l,a]),i.useLayoutEffect(function(){return function(){L(a)}},[a]),d&&t!==null)return i.createElement("div",{ref:s,className:"dshcs-slot","data-code-server-slot":a!=null?a:"code-server"});if(f)return i.createElement("div",{className:"dshcs-loading"},"\u6B63\u5728\u542F\u52A8 code-server\u2026");var c=p&&r!=null&&r.error?r.error:"code-server \u672A\u8FD0\u884C",v=o?"\u5F53\u524D\u4EE5 DSH \u540C\u6E90\u8DEF\u5F84 "+(r!=null&&r.url||"/code-server/")+" \u63D0\u4F9B(\u65E0\u72EC\u7ACB\u7AEF\u53E3)\u3002":"\u5F53\u524D\u4EE5\u72EC\u7ACB\u56DE\u73AF\u7AEF\u53E3\u63D0\u4F9B(\u7AEF\u53E3 "+(r!=null&&r.port!=null?r.port:"8090")+" \u88AB\u5360\u7528\u65F6\u8BF7\u91CA\u653E\u6216\u4FEE\u6539 port \u914D\u7F6E)\u3002",y=N?"\u5E38\u9A7B\u9762:\u53EF\u7528(\u5207\u6807\u7B7E/\u6536\u8D77\u4FA7\u680F\u4E0D\u91CD\u8F7D)\u3002":"\u5E38\u9A7B\u9762:\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 Element.moveBefore \u2014\u2014 \u5207\u6807\u7B7E\u4F1A\u6574\u9875\u91CD\u8F7D(\u5347\u7EA7\u6D4F\u89C8\u5668\u540E\u81EA\u52A8\u53EF\u7528)\u3002";return i.createElement("div",{className:"dshcs-empty"},i.createElement("div",{className:"dshcs-emptybox"},i.createElement("div",null,p?"code-server \u542F\u52A8\u5931\u8D25":"code-server \u672A\u8FD0\u884C"),i.createElement("pre",{className:"dshcs-error"},c),i.createElement("p",{className:"dshcs-hint"},"VS Code \u6811\u968F\u63D2\u4EF6\u5305\u5185\u7F6E\u3001\u5C31\u5730\u8FD0\u884C(\u65E0\u9700\u5168\u5C40\u5B89\u88C5\u3001\u65E0\u9700\u8054\u7F51\u5B89\u88C5\u3001\u65E0\u300C\u5B89\u88C5\u73AF\u5883\u300D\u6B65\u9AA4);\u5185\u90E8\u4F9D\u8D56\u4E0E\u9884\u7F16\u8BD1\u539F\u751F\u6A21\u5757\u7531\u5305\u7BA1\u7406\u5668\u5728\u5B89\u88C5\u63D2\u4EF6\u65F6\u4E00\u5E76\u88C5\u597D(\u65E0\u9700 C++ \u5DE5\u5177\u94FE)\u3002\u82E5\u6B64\u5904\u957F\u671F\u672A\u8FD0\u884C,\u8BF7\u67E5\u770B DSH host \u65E5\u5FD7\u91CC\u7684 [code-server] \u8F93\u51FA(\u6216\u5728\u8BBE\u7F6E\u5361\u7247\u91CC\u5207\u6362\u300C\u540E\u53F0\u5E38\u9A7B\u300D\u89E6\u53D1\u4E00\u6B21\u542F\u52A8)\u3002"+v+y)))}function ze(e){var r=B(),t=r.status,l=t!=null&&t.ok===!0&&t.running===!0,a=t!=null&&t.keepResident===!0,s=de(e&&e.useSessions,e&&e.useWorkspaces),d=l?oe(t,s):null;return i.useEffect(function(){!a||!l||d===null||H({src:d,sameOrigin:t!=null&&t.serve==="dsh"})},[a,l,d,t!=null?t.serve:null]),null}var je=".dshcs-frame{display:block;position:absolute;inset:0;z-index:1;width:100%;height:100%;border:0;background:var(--dsw-alias-bg-base,#fff)}.dshcs-tabroot{position:relative;display:flex;flex-direction:column;width:100%;height:100%;min-width:0;min-height:0;background:var(--dsw-alias-bg-base,#fff)}.dshcs-slot{position:relative;display:block;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;background:var(--dsw-alias-bg-base,#fff)}.dshcs-park{position:fixed;left:-20000px;top:0;width:320px;height:200px;overflow:hidden;pointer-events:none;z-index:0;visibility:hidden;contain:strict}.dshcs-loading{position:absolute;inset:0;z-index:2;display:grid;place-items:center;background:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-tertiary,#7d8798);font-size:13px}.dshcs-empty{position:relative;z-index:2;flex:1;display:flex;align-items:center;justify-content:center;padding:44px 24px 24px}.dshcs-emptybox{max-width:560px;text-align:left;background:var(--dsw-alias-bg-layer-2,#f7f8fb);border:1px solid var(--dsw-alias-border-l2,#dfe3eb);border-radius:12px;padding:16px 18px}.dshcs-error{color:var(--dsw-alias-label-error,#d92d20);white-space:pre-wrap;word-break:break-all;font-family:ui-monospace,Consolas,monospace;font-size:12px;margin:8px 0 0}.dshcs-hint{color:var(--dsw-alias-label-tertiary,#7d8798);font-size:12px;margin:6px 0 0}.dshcs-legacy{color:var(--dsw-alias-label-warning,#b54708);font-size:12px;font-weight:600;margin:0 0 6px}",te="dsh-code-server/styles";typeof document!="undefined"&&document.querySelector("style[data-dshcs="+JSON.stringify(te)+"]")===null&&(T=document.createElement("style"),T.setAttribute("data-dshcs",te),T.textContent=je,document.head.appendChild(T));var T,ne="code-server",ae="dsh-code-server-app",Pe=2500,He=1e4,Ue=1500;function _e(e){var r=e!=null&&typeof e.size=="number"?e.size:16;return i.createElement("img",{src:Ie,alt:"","aria-hidden":!0,draggable:!1,className:e!=null?e.className:void 0,style:{width:r,height:r,display:"block",objectFit:"contain",WebkitUserDrag:"none",userSelect:"none"}})}function Be(){var e=A.status;return e!=null&&e.fileOpenScope==="all"?"all":Y}function Fe(e,r){try{var t=e(function(a){return a});if(t!=null&&r!=null&&t.byId!=null){var l=t.byId[r];if(l!=null&&typeof l.cwd=="string"&&l.cwd!=="")return l.cwd}}catch(a){}}function Ge(e){var r=e.useTabInfo(),t=r.tab,l=B(),a=l.status,s=t.navigation,d=s!=null&&typeof s.revision=="number"?s.revision:0,f=s!=null&&typeof s.address=="string"?s.address:"",p=I(f)?null:M(f),o=Fe(e.useSessions,p!=null?p.sessionId:void 0),c=o!==void 0?o:de(e.useSessions,null),v=V(p,c),y=s!=null&&s.params!=null&&typeof s.params.line=="number"?s.params.line:null,u=i.useRef(void 0),[m,b]=i.useState(0);return i.useEffect(function(){if(!(typeof c!="string"||c==="")&&u.current!==c){var g=u.current!==void 0;u.current=c;var w=!1;return E("/code-server/start",{cwd:c}).then(function(S){w||(C({status:S}),g&&S!=null&&S.ok===!0&&S.running===!0&&b(function(F){return F+1}))}).catch(function(){}),function(){w=!0}}},[c]),i.useEffect(function(){E("/code-server/status").then(function(w){w!=null&&C({status:w})}).catch(function(){});var g=window.setInterval(function(){E("/code-server/status").then(function(w){C({status:w})}).catch(function(){})},3e3);return function(){window.clearInterval(g)}},[]),i.useEffect(function(){v!==null&&E("/code-server/open-file",y===null?{file:v}:{file:v,line:y}).catch(function(){})},[d,v,y]),i.createElement("div",{className:"dshcs-tabroot","data-code-server-tab":"body"},i.createElement(De,{status:a,pageUrl:oe(a,c),reloadTick:m,owner:"tab:"+t.id}))}function U(e,r){if(e==null)return null;var t=e[r];if(t!=null)return t;if(typeof e.get=="function"){var l=e.get(r);if(l!=null)return l}return null}function Qe(e){var r=U(e,"sidebarRightTabs"),t=U(e,"sidebarRight");if(r==null||t==null)return console.error("[code-server] \u53F3\u4FA7\u680F\u670D\u52A1\u4E0A\u4E0B\u6587\u4E0D\u53EF\u89C1(sidebarRightTabs="+(r!=null)+", sidebarRight="+(t!=null)+"):\u8DF3\u8FC7\u4FA7\u680F\u6CE8\u518C"),!1;var l=U(e,"slots");if(e.effect(function(){return r.register({id:ae,kind:ne,priority:"extension",patterns:["dsh-resource://file/**"],canOpen:function(a){return X(M(a),Be())},title:function(a){if(I(a)||a===void 0||a===null||a==="")return"Code Server";var s=J(a);return s===""?"Code Server":s},guide:[{order:20,title:function(){return"Code Server"},description:function(){return"\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC\u8FD0\u884C VS Code \u7F51\u9875\u7248,\u8DDF\u968F\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u533A;\u4EA7\u7269/\u4EA4\u4ED8\u6587\u4EF6\u70B9\u51FB\u540E\u5728\u6B64\u6253\u5F00\u3002"},icon:_e}]})},"code-server: sidebar tab type"),l!=null)e.effect(function(){return l.inject("sidebar.right.pane.tab",function(){return l.register({name:"sidebar.right.pane.tab",key:ae},Ge)})},"code-server: sidebar tab body");else return console.error("[code-server] slots \u670D\u52A1\u4E0D\u53EF\u89C1:\u4FA7\u680F\u6807\u7B7E body \u672A\u6CE8\u518C"),!1;return e.effect(function(){return function(){C({sidebarUi:"unknown"})}},"code-server: sidebar mode reset"),console.log("[code-server] right-sidebar tab registered (kind="+ne+")"),!0}var We=".dshcs-card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}.dshcs-card:hover{border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}.dshcs-cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}.dshcs-cardHeader{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}.dshcs-cardHeader:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}.dshcs-cardHeadText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.dshcs-cardName{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}.dshcs-cardDescription{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));font-size:13px;line-height:1.5}.dshcs-cardChevron{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));flex:none;transition:transform .16s;display:inline-flex}.dshcs-cardChevronOpen{transform:rotate(180deg)}.dshcs-cardBody{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}.dshcs-cardReadOnly{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:12px 0 0;font-size:12px;line-height:1.5}.dshcs-pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.dshcs-cardFooter{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}.dshcs-cardFailed{min-width:0;color:var(--dsw-alias-label-error,var(--dsw-alias-state-error-primary));flex:1;margin:0;font-size:12px;line-height:1.5}.dshcs-cbtn{appearance:none;font:inherit;cursor:pointer;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5;border:1px solid transparent;transition:color .12s ease,background .12s ease}.dshcs-cbtn:disabled{opacity:.4;cursor:default}.dshcs-cbtn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.dshcs-cbtnOutline{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}.dshcs-cbtnOutline:hover:not(:disabled){color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover,transparent)}.dshcs-cbtnPrimary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3);border-color:var(--dsw-alias-label-primary);font-weight:600}.dshcs-cbtnPrimary:hover:not(:disabled){filter:brightness(.95)}.dshcs-cbtnPrimary:active:not(:disabled){filter:brightness(.9)}.dshcs-field{flex-direction:column;gap:6px;padding:12px 0;display:flex}.dshcs-field+.dshcs-field{border-top:1px solid var(--dsw-alias-border-l2)}.dshcs-fieldHead{align-items:center;gap:8px;display:flex}.dshcs-fieldLabel{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}.dshcs-card .dshcs-hint{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:0;font-size:12px;line-height:1.5}.dshcs-check{display:flex;align-items:center;gap:8px;cursor:pointer}.dshcs-check input{accent-color:var(--dsw-alias-brand-primary);width:15px;height:15px;margin:0;flex:none}.dshcs-check input:disabled{cursor:default}.dshcs-select{display:inline-flex;align-items:center}.dshcs-select select{font:inherit;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-3,transparent);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:4px 8px;min-width:220px;cursor:pointer}.dshcs-select select:disabled{opacity:.5;cursor:default}.dshcs-badges{align-items:center;gap:8px;display:inline-flex}.dshcs-badge{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.dshcs-reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}.dshcs-reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.dshcs-reset:disabled{cursor:default}",Ye="dsh-code-server/Card.module.css";function Ze(e,r){if(typeof document!="undefined"&&document.querySelector("style[data-plugin-css="+JSON.stringify(e)+"]")===null){var t=document.createElement("style");t.dataset.plugin="dsh-code-server",t.dataset.pluginCss=e,t.textContent=r,document.head.appendChild(t)}}Ze(Ye,We);function Je(e){return i.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none","aria-hidden":!0,className:e.className},i.createElement("path",{d:"M3.5 5.25L7 8.75L10.5 5.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))}function le(e){return i.createElement("button",{type:"button",className:"dshcs-cbtn "+(e.variant==="primary"?"dshcs-cbtnPrimary":"dshcs-cbtnOutline"),disabled:e.disabled===!0,onClick:e.onClick},e.children)}function Ve(e){return i.createElement("label",{className:"dshcs-check"},i.createElement("input",{type:"checkbox",checked:e.checked===!0,disabled:e.disabled===!0,onChange:function(r){e.onChange(r.target.checked)}}),i.createElement("span",{className:"dshcs-hint"},e.children))}function Xe(e){var r=Array.isArray(e.options)?e.options:[];return i.createElement("label",{className:"dshcs-select"},i.createElement("select",{value:e.value,disabled:e.disabled===!0,onChange:function(t){e.onChange(t.target.value)}},r.map(function(t){return i.createElement("option",{key:t.value,value:t.value},t.label)})))}function ie(e){var r=[];return e.overridden===!0&&(r.push(i.createElement("span",{className:"dshcs-badge"},e.overriddenLabel)),r.push(i.createElement("button",{type:"button",className:"dshcs-reset",disabled:e.disabled===!0,onClick:e.onReset},e.resetLabel))),r.length===0?null:i.createElement("span",{className:"dshcs-badges"},...r)}function se(e){var[r,t]=i.useState(e.defaultOpen===!0),l=e.state;if(l==null||l.available!==!0)return null;var a=e.title,s=e.noticeOnly===!0,d=l.dirty!==!0||l.invalid===!0||l.saving===!0;return i.createElement("li",{className:"dshcs-card"+(r?" dshcs-cardOpen":"")},i.createElement("button",{type:"button",className:"dshcs-cardHeader","aria-expanded":r,onClick:function(){t(!r)}},i.createElement("span",{className:"dshcs-cardHeadText"},i.createElement("span",{className:"dshcs-cardName"},a),i.createElement("span",{className:"dshcs-cardDescription"},e.description)),l.dirty===!0?i.createElement("span",{className:"dshcs-pending"},e.unsavedLabel):null,i.createElement(Je,{className:"dshcs-cardChevron"+(r?" dshcs-cardChevronOpen":"")})),r===!0?i.createElement("div",{className:"dshcs-cardBody"},s===!0?null:l.writable!==!0?i.createElement("p",{className:"dshcs-cardReadOnly",role:"status"},e.readOnlyLabel):null,e.children,s===!0?null:i.createElement("div",{className:"dshcs-cardFooter"},l.failed===!0?i.createElement("p",{className:"dshcs-cardFailed",role:"status"},e.saveFailedLabel):null,i.createElement(le,{disabled:l.dirty!==!0||l.saving===!0,onClick:e.onDiscard},e.discardLabel),i.createElement(le,{variant:"primary",disabled:d,onClick:e.onSave},l.saving===!0?e.savingLabel:e.saveLabel))):null)}function Ke(e){try{let k=function(){E("/code-server/status").then(function(h){h!=null&&typeof h=="object"&&C({status:h})}).catch(function(){})};var r=e.scope,[t,l]=i.useState(function(){return r!==void 0?r.getSnapshot():null}),[a,s]=i.useState(null),[d,f]=i.useState(!1),[p,o]=i.useState(!1),c=B(),[v,y]=i.useState(q());if(i.useEffect(function(){return K(function(h){y(h)})},[]),i.useEffect(function(){if(r===void 0||typeof r.subscribe!="function")return;function h(){try{l(r.getSnapshot())}catch(nr){}}var x=r.subscribe(h);return function(){typeof x=="function"&&x()}},[r]),r===void 0)return console.error("[code-server] card scope missing"),null;if(t==null||t.status!=="ready")return t!=null&&t.status==="unavailable"&&console.warn("[code-server] settings scope unavailable:",t.status),null;var u=t.value!==void 0&&t.value!==null?t.value:{},m=t.user,b={keepResident:u.keepResident!==!1,fileOpenScope:u.fileOpenScope==="all"?"all":"session"};if(c!=null&&c.sidebarUi==="legacy")return i.createElement(se,{title:"Code Server",description:"\u5F53\u524D DSH \u7248\u672C\u4E0D\u53D7\u652F\u6301(\u7F3A\u5C11\u53F3\u4FA7\u680F\u670D\u52A1)",defaultOpen:!0,noticeOnly:!0,state:{available:!0,writable:!1,dirty:!1,invalid:!1,saving:!1,failed:!1}},i.createElement("div",{className:"dshcs-field"},i.createElement("div",{className:"dshcs-legacy"},"\u672C\u63D2\u4EF6\u81EA 0.2.3 \u8D77\u4E0D\u518D\u517C\u5BB9\u65E7\u7248 DSH\u3002"),i.createElement("div",{className:"dshcs-hint",style:{marginTop:0}},`\u672A\u68C0\u6D4B\u5230\u53F3\u4FA7\u680F\u63D2\u4EF6\u670D\u52A1 sidebarRightTabs / sidebarRight,\u56E0\u6B64\u63D2\u4EF6\u4E0D\u63D0\u4F9B\u4EFB\u4F55\u5165\u53E3(\u65E7\u7248\u7684\u60AC\u6D6E\u7403\u4E0E\u6D6E\u52A8\u7A97\u53E3\u5DF2\u79FB\u9664),\u4E5F\u4E0D\u4F1A\u540E\u53F0\u542F\u52A8 IDE\u3002
|
|
3
|
-
\u5347\u7EA7 DSH \u5230\u5E26\u53F3\u4FA7\u680F\u7684\u7248\u672C(\u2265 0.1.5-alpha.1)\u540E,Code Server \u4F1A\u51FA\u73B0\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC,\u672C\u9875\u540C\u65F6\u663E\u793A\u5B8C\u6574\u8BBE\u7F6E\u9879;\u5347\u7EA7\u540E\u65E0\u9700\u91CD\u88C5\u672C\u63D2\u4EF6,\u5237\u65B0\u9875\u9762\u5373\u53EF\u3002`)));var g=m!=null&&Object.prototype.hasOwnProperty.call(m,"keepResident"),w=m!=null&&Object.prototype.hasOwnProperty.call(m,"fileOpenScope"),S=a!==null&&(a.keepResident!==b.keepResident||a.fileOpenScope!==b.fileOpenScope),F=!S||d,ce={available:!0,writable:t.writable,dirty:S,invalid:!1,saving:d,failed:p};async function ue(){if(S&&!d){f(!0),o(!1);try{var h=a!==null?a:b;await e.scope.set("keepResident",h.keepResident===!0),await e.scope.set("fileOpenScope",h.fileOpenScope==="all"?"all":"session"),s(null),k()}catch(x){o(!0)}f(!1)}}async function G(){if(!(d||t.writable!==!0)){f(!0),o(!1);try{typeof e.scope.unset=="function"?(await e.scope.unset("keepResident"),await e.scope.unset("fileOpenScope")):(await e.scope.set("keepResident",u.keepResident===void 0||u.keepResident===null?!0:u.keepResident),await e.scope.set("fileOpenScope",u.fileOpenScope==="all"?"all":"session")),s(null),k()}catch(h){o(!0)}f(!1)}}return
|
|
2
|
+
var T=Object.defineProperty;var fe=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var ve=Object.prototype.hasOwnProperty;var he=(e,r)=>{for(var t in r)T(e,t,{get:r[t],enumerable:!0})},be=(e,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of pe(r))!ve.call(e,a)&&a!==t&&T(e,a,{get:()=>r[a],enumerable:!(i=fe(r,a))||i.enumerable});return e};var ge=e=>be(T({},"__esModule",{value:!0}),e);var tr={};he(tr,{apply:()=>qe,inject:()=>er,name:()=>rr});module.exports=ge(tr);var Q="dsh-resource://file/",me="sidebar://",Y="session";function I(e){return typeof e=="string"&&e.startsWith(me)}function M(e){if(typeof e!="string"||!e.startsWith(Q))return null;for(var r=e.length,t=0;t<e.length;t+=1){var i=e.charAt(t);if(i==="?"||i==="#"){r=t;break}}var a=e.slice(Q.length,r).split("/"),s=a.shift();try{if(s==="session"){var d=a.shift();return d===void 0||d===""||a.length===0?null:{scope:"session",sessionId:decodeURIComponent(d),path:W(a)}}if(s==="absolute"){var f=a[0]===""&&a.length>1,p=f?a.slice(1):a,o=W(p);return(o===""||o.charAt(0)==="/")&&!f?null:f?{scope:"absolute",path:"//"+o}:o===""?null:{scope:"absolute",path:Z(o)?o:"/"+o}}}catch(c){return null}return null}function W(e){for(var r=[],t=0;t<e.length;t+=1)r.push(decodeURIComponent(e[t]));return r.join("/")}function Z(e){return/^[A-Za-z]:($|\/)/.test(e)}function ye(e){return typeof e!="string"||e===""?!1:e.charAt(0)==="/"?!0:Z(e)}function J(e){var r=M(e);if(r===null)return"";var t=r.path.replace(/[/\\]+$/,""),i=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\")),a=i===-1?t:t.slice(i+1);return a}function V(e,r){if(e===null||e==null)return null;var t=typeof e.path=="string"?e.path:"";if(t==="")return null;if(ye(t))return t;if(typeof r!="string"||r==="")return null;var i=r.indexOf("\\")!==-1?"\\":"/",a=r.replace(/[\\/]+$/,"");return a+i+(i==="\\"?t.replace(/\//g,"\\"):t)}function X(e,r){return e===null||e==null?!1:e.scope==="session"?!0:r==="all"}var N=typeof Element!="undefined"&&typeof Element.prototype.moveBefore=="function",we=-2e4,n={park:null,frame:null,currentSrc:null,sameOrigin:null,owner:null,lastRect:null,parkStrategy:"offscreen",degraded:!1,preloaded:!1,nudgeCount:0,nudgeEnabled:!0,lastNudgeAt:0,listeners:new Set};function D(){return{ready:n.frame!==null,docked:n.owner!==null,owner:n.owner,src:n.currentSrc,sameOrigin:n.sameOrigin,parkStrategy:n.parkStrategy,degraded:n.degraded,preloaded:n.preloaded,supportsMoveBefore:N,nudgeCount:n.nudgeCount,lastNudgeAt:n.lastNudgeAt}}function O(){var e=D();n.listeners.forEach(function(r){try{r(e)}catch(t){}})}function K(e){return n.listeners.add(e),function(){n.listeners.delete(e)}}function q(){return D()}function xe(e){e!=="offscreen"&&e!=="behind"||n.parkStrategy!==e&&(n.parkStrategy=e,n.frame!==null&&n.owner===null&&z(),O())}function Se(){return n.parkStrategy}function ke(){var e=n.lastRect;e!==null&&(n.park.style.width=Math.max(1,Math.round(e.width))+"px",n.park.style.height=Math.max(1,Math.round(e.height))+"px")}function z(){if(n.park!==null){if(ke(),n.parkStrategy==="behind"&&n.lastRect!==null){n.park.style.left=Math.round(n.lastRect.left)+"px",n.park.style.top=Math.round(n.lastRect.top)+"px",n.park.style.visibility="visible",n.park.style.zIndex="0";return}n.park.style.left=we+"px",n.park.style.top="0px",n.park.style.visibility="hidden",n.park.style.zIndex="0"}}function $(){n.frame!==null&&(n.frame.setAttribute("inert",""),n.frame.setAttribute("aria-hidden","true"))}function Ee(){n.frame!==null&&(n.frame.removeAttribute("inert"),n.frame.removeAttribute("aria-hidden"))}function Ce(){var e=document.createElement("div");e.className="dshcs-park",e.setAttribute("data-dshcs-park",""),e.setAttribute("aria-hidden","true");var r=document.createElement("iframe");return r.className="dshcs-frame",r.setAttribute("title","code-server"),r.setAttribute("allow","clipboard-read; clipboard-write"),r.setAttribute("data-dshcs-resident",""),r.src="about:blank",e.appendChild(r),document.body.appendChild(e),n.park=e,n.frame=r,n.currentSrc="about:blank",n.owner=null,z(),$(),r}function Ne(e){var r=n.frame;if(r!==null){var t=n.sameOrigin!==e;!t&&r.hasAttribute("data-dshcs-attrs")||(e===!0?r.removeAttribute("sandbox"):e===!1&&r.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms allow-modals allow-popups allow-pointer-lock allow-clipboard-read allow-clipboard-write"),r.setAttribute("data-dshcs-attrs",e===!0?"same-origin":"cross-origin"),n.sameOrigin=e)}}function j(e){var r=e||{};return n.frame===null&&Ce(),typeof r.sameOrigin=="boolean"&&Ne(r.sameOrigin),typeof r.src=="string"&&r.src!==""&&r.src!==n.currentSrc&&Oe(r.src),n.frame}function Oe(e){n.frame===null||typeof e!="string"||e===""||e===n.currentSrc||(n.currentSrc=e,n.frame.src=e,O())}function ee(){var e=n.frame;if(n.nudgeEnabled!==!0||e===null||e.isConnected!==!0)return!1;var r=e.style.display;return e.style.display="none",e.offsetHeight,e.style.display=r,n.nudgeCount+=1,n.lastNudgeAt=Date.now(),!0}function Ae(e){return n.nudgeEnabled=e!==!1,n.nudgeEnabled}function re(e){if(n.frame!==null){if(N)try{e.moveBefore(n.frame,null);return}catch(r){n.degraded=!0,n.lastMoveError=(r&&r.name?r.name+": ":"")+(r&&r.message?r.message:String(r))}else n.degraded=!0;e.appendChild(n.frame)}}function P(e,r){if(!(n.frame===null||e==null)){var t=n.owner===null,i=e.getBoundingClientRect();i.width>=1&&i.height>=1&&(n.lastRect={left:i.left,top:i.top,width:i.width,height:i.height}),n.owner=r===void 0?null:r,Ee(),n.park.setAttribute("aria-hidden","true"),re(e),t&&ee(),O()}}function A(e){n.frame!==null&&(e!==void 0&&n.owner!==e||(n.owner=null,z(),$(),n.park.setAttribute("aria-hidden","true"),re(n.park),O()))}function U(e){var r=e||{};return j(r),n.owner===null&&(typeof r.src=="string"&&r.src!==""&&(n.preloaded=!0),A()),n.frame}function Le(){n.park!==null&&n.park.parentNode!==null&&n.park.parentNode.removeChild(n.park),n.park=null,n.frame=null,n.currentSrc=null,n.sameOrigin=null,n.owner=null,n.lastRect=null,n.degraded=!1,n.preloaded=!1,n.nudgeCount=0,n.lastNudgeAt=0,O()}typeof window!="undefined"&&(window.__dshcsSurface={snapshot:D,setParkStrategy:xe,getParkStrategy:Se,preload:U,dock:P,park:A,nudge:ee,setNudgeEnabled:Ae,destroy:Le});var l=require("react"),_=new Set,L={status:null,busy:!1,sidebarUi:"unknown",sidebarRegisterFailed:!1};function C(e){L=Object.assign({},L,e),_.forEach(function(r){r()})}function Me(e){return _.add(e),function(){_.delete(e)}}function Re(){return L}function B(){return l.useSyncExternalStore(Me,Re)}var Te="/api",Ie="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMTQ3IDE0NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8c3R5bGU+QG1lZGlhIChwcmVmZXJzLWNvbG9yLXNjaGVtZTogZGFyaykgeyogeyBmaWxsOiB3aGl0ZTsgfX08L3N0eWxlPgogIDxwYXRoIGQ9Im00Mi40MjE0LDM5LjY1NWMtMjQuNDA1NywwIC00Mi4xNTU0LDEzLjE3MjEgLTQyLjE1NTQsMzMuODQ1YzAsMjAuNTgxNCAxOC40ODkyLDMzLjg0NSA0Mi4xNTU0LDMzLjg0NWMyMy42NjYyLDAgMzguMTgwMywtMTEuNjE3MSAzOC43MzQ5LC0yOC43MjI1bC0yMS4wNzc3LC0wLjQ1NzRjLTAuOTI0NCw5LjMzMDMgLTkuMTA1OSwxNS4xODQ1IC0xNy42NTcyLDE1LjE4NDVjLTExLjc0MDYsMCAtMjAuNDMwNiwtNy41OTIyIC0yMC40MzA2LC0xOS44NDk2YzAsLTEyLjI1NzQgOC42OSwtMTkuOTg2OCAyMC40MzA2LC0yMC4yMTU1YzguNTUxMywtMC4xODMgMTYuOTE3Nyw1Ljk0NTcgMTcuNDcyMywxNS4yNzZsMjEuMDc3NywtMC42NDAzYy0wLjQ2MjIsLTE2LjgzMTEgLTE0LjE0NDIsLTI4LjI2NTIgLTM4LjU1LC0yOC4yNjUyem00OC44NDQ2LDJsNTUuNDY4LDBsMCw2NC4wMzExbC01NS40NjgsMGwwLC02NC4wMzExeiIgY2xpcC1ydWxlPSJldmVub2RkIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz4KPC9zdmc+Cg==";async function E(e,r){var t={method:r===void 0?"GET":"POST",headers:{}};r!==void 0&&(t.headers["content-type"]="application/json",t.body=JSON.stringify(r));var i=await fetch(Te+e,t),a=await i.text(),s=null;try{s=a===""?null:JSON.parse(a)}catch(d){s=null}return i.ok?s!==null?s:{ok:!1,error:"invalid JSON response"}:{ok:!1,error:"HTTP "+i.status+(s!==null&&s.error!==void 0?": "+s.error:"")}}function de(e,r){try{var t=e(function(v){return v}),i=r===null?null:typeof r=="function"?r(function(v){return v}):null,a=t!=null?t.current:void 0;if(a!==void 0&&t!=null&&t.byId!=null){var s=t.byId[a];if(s!=null&&typeof s.cwd=="string"&&s.cwd!=="")return s.cwd}var d=i!=null&&Array.isArray(i.items)?i.items:[];if(a!==void 0)for(var f=0;f<d.length;f++){var p=d[f];if(p.sessionIds!=null&&p.sessionIds.indexOf(a)!==-1&&typeof p.path=="string"&&p.path!=="")return p.path}var o=i!=null?i.recentWorkspaceId:void 0;if(o!==void 0){for(var c=0;c<d.length;c++)if(d[c].workspaceId===o&&typeof d[c].path=="string"&&d[c].path!=="")return d[c].path}if(d.length>0&&typeof d[0].path=="string"&&d[0].path!=="")return d[0].path}catch(v){}}function oe(e,r){if(e==null||typeof e.url!="string"||e.url==="")return null;var t=e.pid!=null?String(e.pid):e.startedAt!=null?String(e.startedAt):"0",i=e.url+"?s="+encodeURIComponent(t),a=typeof r=="string"&&r!==""?r:e!=null&&e.cwd!=null?e.cwd:null;if(a==null||a==="")return i;var s=a.replace(/\\/g,"/"),d=s;return(/^[A-Za-z]:\//.test(s)||s.charCodeAt(0)!==47)&&(d="/"+s),i+"&folder="+encodeURIComponent(d)}function De(e){var r=e.status,t=e.pageUrl,i=e.reloadTick,a=e.owner,s=l.useRef(null),d=r!=null&&r.ok===!0&&r.running===!0,f=r!=null&&r.status==="starting",p=r!=null&&r.ok===!1,o=r!=null&&r.serve==="dsh";if(l.useLayoutEffect(function(){if(!d||t===null){A(a);return}j({src:t,sameOrigin:o}),s.current!==null&&P(s.current,a)},[d,t,o,i,a]),l.useLayoutEffect(function(){return function(){A(a)}},[a]),d&&t!==null)return l.createElement("div",{ref:s,className:"dshcs-slot","data-code-server-slot":a!=null?a:"code-server"});if(f)return l.createElement("div",{className:"dshcs-loading"},"\u6B63\u5728\u542F\u52A8 code-server\u2026");var c=p&&r!=null&&r.error?r.error:"code-server \u672A\u8FD0\u884C",v=o?"\u5F53\u524D\u4EE5 DSH \u540C\u6E90\u8DEF\u5F84 "+(r!=null&&r.url||"/code-server/")+" \u63D0\u4F9B(\u65E0\u72EC\u7ACB\u7AEF\u53E3)\u3002":"\u5F53\u524D\u4EE5\u72EC\u7ACB\u56DE\u73AF\u7AEF\u53E3\u63D0\u4F9B(\u7AEF\u53E3 "+(r!=null&&r.port!=null?r.port:"8090")+" \u88AB\u5360\u7528\u65F6\u8BF7\u91CA\u653E\u6216\u4FEE\u6539 port \u914D\u7F6E)\u3002",y=N?"\u5E38\u9A7B\u9762:\u53EF\u7528(\u5207\u6807\u7B7E/\u6536\u8D77\u4FA7\u680F\u4E0D\u91CD\u8F7D)\u3002":"\u5E38\u9A7B\u9762:\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 Element.moveBefore \u2014\u2014 \u5207\u6807\u7B7E\u4F1A\u6574\u9875\u91CD\u8F7D(\u5347\u7EA7\u6D4F\u89C8\u5668\u540E\u81EA\u52A8\u53EF\u7528)\u3002";return l.createElement("div",{className:"dshcs-empty"},l.createElement("div",{className:"dshcs-emptybox"},l.createElement("div",null,p?"code-server \u542F\u52A8\u5931\u8D25":"code-server \u672A\u8FD0\u884C"),l.createElement("pre",{className:"dshcs-error"},c),l.createElement("p",{className:"dshcs-hint"},"VS Code \u6811\u968F\u63D2\u4EF6\u5305\u5185\u7F6E\u3001\u5C31\u5730\u8FD0\u884C(\u65E0\u9700\u5168\u5C40\u5B89\u88C5\u3001\u65E0\u9700\u8054\u7F51\u5B89\u88C5\u3001\u65E0\u300C\u5B89\u88C5\u73AF\u5883\u300D\u6B65\u9AA4);\u5185\u90E8\u4F9D\u8D56\u4E0E\u9884\u7F16\u8BD1\u539F\u751F\u6A21\u5757\u7531\u5305\u7BA1\u7406\u5668\u5728\u5B89\u88C5\u63D2\u4EF6\u65F6\u4E00\u5E76\u88C5\u597D(\u65E0\u9700 C++ \u5DE5\u5177\u94FE)\u3002\u82E5\u6B64\u5904\u957F\u671F\u672A\u8FD0\u884C,\u8BF7\u67E5\u770B DSH host \u65E5\u5FD7\u91CC\u7684 [code-server] \u8F93\u51FA(\u6216\u5728\u8BBE\u7F6E\u5361\u7247\u91CC\u5207\u6362\u300C\u540E\u53F0\u5E38\u9A7B\u300D\u89E6\u53D1\u4E00\u6B21\u542F\u52A8)\u3002"+v+y)))}function ze(e){var r=B(),t=r.status,i=t!=null&&t.ok===!0&&t.running===!0,a=t!=null&&t.keepResident===!0,s=de(e&&e.useSessions,e&&e.useWorkspaces),d=i?oe(t,s):null;return l.useEffect(function(){!a||!i||d===null||U({src:d,sameOrigin:t!=null&&t.serve==="dsh"})},[a,i,d,t!=null?t.serve:null]),null}var je=".dshcs-frame{display:block;position:absolute;inset:0;z-index:1;width:100%;height:100%;border:0;background:var(--dsw-alias-bg-base,#fff)}.dshcs-tabroot{position:relative;display:flex;flex-direction:column;width:100%;height:100%;min-width:0;min-height:0;background:var(--dsw-alias-bg-base,#fff)}.dshcs-slot{position:relative;display:block;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;background:var(--dsw-alias-bg-base,#fff)}.dshcs-park{position:fixed;left:-20000px;top:0;width:320px;height:200px;overflow:hidden;pointer-events:none;z-index:0;visibility:hidden;contain:strict}.dshcs-loading{position:absolute;inset:0;z-index:2;display:grid;place-items:center;background:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-tertiary,#7d8798);font-size:13px}.dshcs-empty{position:relative;z-index:2;flex:1;display:flex;align-items:center;justify-content:center;padding:44px 24px 24px}.dshcs-emptybox{max-width:560px;text-align:left;background:var(--dsw-alias-bg-layer-2,#f7f8fb);border:1px solid var(--dsw-alias-border-l2,#dfe3eb);border-radius:12px;padding:16px 18px}.dshcs-error{color:var(--dsw-alias-label-error,#d92d20);white-space:pre-wrap;word-break:break-all;font-family:ui-monospace,Consolas,monospace;font-size:12px;margin:8px 0 0}.dshcs-hint{color:var(--dsw-alias-label-tertiary,#7d8798);font-size:12px;margin:6px 0 0}.dshcs-legacy{color:var(--dsw-alias-label-warning,#b54708);font-size:12px;font-weight:600;margin:0 0 6px}",te="dsh-code-server/styles";typeof document!="undefined"&&document.querySelector("style[data-dshcs="+JSON.stringify(te)+"]")===null&&(R=document.createElement("style"),R.setAttribute("data-dshcs",te),R.textContent=je,document.head.appendChild(R));var R,ne="code-server",ae="dsh-code-server-app",Pe=2500,Ue=1e4,He=1500;function _e(e){var r=e!=null&&typeof e.size=="number"?e.size:16;return l.createElement("img",{src:Ie,alt:"","aria-hidden":!0,draggable:!1,className:e!=null?e.className:void 0,style:{width:r,height:r,display:"block",objectFit:"contain",WebkitUserDrag:"none",userSelect:"none"}})}function Be(){var e=L.status;return e!=null&&e.fileOpenScope==="all"?"all":Y}function Fe(e,r){try{var t=e(function(a){return a});if(t!=null&&r!=null&&t.byId!=null){var i=t.byId[r];if(i!=null&&typeof i.cwd=="string"&&i.cwd!=="")return i.cwd}}catch(a){}}function Ge(e){var r=e.useTabInfo(),t=r.tab,i=B(),a=i.status,s=t.navigation,d=s!=null&&typeof s.revision=="number"?s.revision:0,f=s!=null&&typeof s.address=="string"?s.address:"",p=I(f)?null:M(f),o=Fe(e.useSessions,p!=null?p.sessionId:void 0),c=o!==void 0?o:de(e.useSessions,null),v=V(p,c),y=s!=null&&s.params!=null&&typeof s.params.line=="number"?s.params.line:null,u=l.useRef(void 0),[m,b]=l.useState(0);return l.useEffect(function(){if(!(typeof c!="string"||c==="")&&u.current!==c){var g=u.current!==void 0;u.current=c;var w=!1;return E("/code-server/start",{cwd:c}).then(function(S){w||(C({status:S}),g&&S!=null&&S.ok===!0&&S.running===!0&&b(function(F){return F+1}))}).catch(function(){}),function(){w=!0}}},[c]),l.useEffect(function(){E("/code-server/status").then(function(w){w!=null&&C({status:w})}).catch(function(){});var g=window.setInterval(function(){E("/code-server/status").then(function(w){C({status:w})}).catch(function(){})},3e3);return function(){window.clearInterval(g)}},[]),l.useEffect(function(){v!==null&&E("/code-server/open-file",y===null?{file:v}:{file:v,line:y}).catch(function(){})},[d,v,y]),l.createElement("div",{className:"dshcs-tabroot","data-code-server-tab":"body"},l.createElement(De,{status:a,pageUrl:oe(a,c),reloadTick:m,owner:"tab:"+t.id}))}function H(e,r){if(e==null)return null;var t=e[r];if(t!=null)return t;if(typeof e.get=="function"){var i=e.get(r);if(i!=null)return i}return null}function Qe(e){var r=H(e,"sidebarRightTabs"),t=H(e,"sidebarRight");if(r==null||t==null)return console.error("[code-server] \u53F3\u4FA7\u680F\u670D\u52A1\u4E0A\u4E0B\u6587\u4E0D\u53EF\u89C1(sidebarRightTabs="+(r!=null)+", sidebarRight="+(t!=null)+"):\u8DF3\u8FC7\u4FA7\u680F\u6CE8\u518C"),!1;var i=H(e,"slots");if(e.effect(function(){return r.register({id:ae,kind:ne,priority:"extension",patterns:["dsh-resource://file/**"],canOpen:function(a){return X(M(a),Be())},title:function(a){if(I(a)||a===void 0||a===null||a==="")return"Code Server";var s=J(a);return s===""?"Code Server":s},guide:[{order:20,title:function(){return"Code Server"},description:function(){return"\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC\u8FD0\u884C VS Code \u7F51\u9875\u7248,\u8DDF\u968F\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u533A;\u4EA7\u7269/\u4EA4\u4ED8\u6587\u4EF6\u70B9\u51FB\u540E\u5728\u6B64\u6253\u5F00\u3002"},icon:_e}]})},"code-server: sidebar tab type"),i!=null)e.effect(function(){return i.inject("sidebar.right.pane.tab",function(){return i.register({name:"sidebar.right.pane.tab",key:ae},Ge)})},"code-server: sidebar tab body");else return console.error("[code-server] slots \u670D\u52A1\u4E0D\u53EF\u89C1:\u4FA7\u680F\u6807\u7B7E body \u672A\u6CE8\u518C"),!1;return e.effect(function(){return function(){C({sidebarUi:"unknown"})}},"code-server: sidebar mode reset"),console.log("[code-server] right-sidebar tab registered (kind="+ne+")"),!0}var We=".dshcs-card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}.dshcs-card:hover{border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}.dshcs-cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}.dshcs-cardHeader{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}.dshcs-cardHeader:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}.dshcs-cardHeadText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.dshcs-cardName{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}.dshcs-cardDescription{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));font-size:13px;line-height:1.5}.dshcs-cardChevron{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));flex:none;transition:transform .16s;display:inline-flex}.dshcs-cardChevronOpen{transform:rotate(180deg)}.dshcs-cardBody{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}.dshcs-cardReadOnly{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:12px 0 0;font-size:12px;line-height:1.5}.dshcs-pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.dshcs-cardFooter{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}.dshcs-cardFailed{min-width:0;color:var(--dsw-alias-label-error,var(--dsw-alias-state-error-primary));flex:1;margin:0;font-size:12px;line-height:1.5}.dshcs-cbtn{appearance:none;font:inherit;cursor:pointer;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5;border:1px solid transparent;transition:color .12s ease,background .12s ease}.dshcs-cbtn:disabled{opacity:.4;cursor:default}.dshcs-cbtn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.dshcs-cbtnOutline{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}.dshcs-cbtnOutline:hover:not(:disabled){color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover,transparent)}.dshcs-cbtnPrimary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3);border-color:var(--dsw-alias-label-primary);font-weight:600}.dshcs-cbtnPrimary:hover:not(:disabled){filter:brightness(.95)}.dshcs-cbtnPrimary:active:not(:disabled){filter:brightness(.9)}.dshcs-field{flex-direction:column;gap:6px;padding:12px 0;display:flex}.dshcs-field+.dshcs-field{border-top:1px solid var(--dsw-alias-border-l2)}.dshcs-fieldHead{align-items:center;gap:8px;display:flex}.dshcs-fieldLabel{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}.dshcs-card .dshcs-hint{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:0;font-size:12px;line-height:1.5}.dshcs-check{display:flex;align-items:center;gap:8px;cursor:pointer}.dshcs-check input{accent-color:var(--dsw-alias-brand-primary);width:15px;height:15px;margin:0;flex:none}.dshcs-check input:disabled{cursor:default}.dshcs-select{display:inline-flex;align-items:center}.dshcs-select select{font:inherit;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-3,transparent);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:4px 8px;min-width:220px;cursor:pointer}.dshcs-select select:disabled{opacity:.5;cursor:default}.dshcs-badges{align-items:center;gap:8px;display:inline-flex}.dshcs-badge{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.dshcs-reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}.dshcs-reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.dshcs-reset:disabled{cursor:default}",Ye="dsh-code-server/Card.module.css";function Ze(e,r){if(typeof document!="undefined"&&document.querySelector("style[data-plugin-css="+JSON.stringify(e)+"]")===null){var t=document.createElement("style");t.dataset.plugin="dsh-code-server",t.dataset.pluginCss=e,t.textContent=r,document.head.appendChild(t)}}Ze(Ye,We);function Je(e){return l.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none","aria-hidden":!0,className:e.className},l.createElement("path",{d:"M3.5 5.25L7 8.75L10.5 5.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))}function le(e){return l.createElement("button",{type:"button",className:"dshcs-cbtn "+(e.variant==="primary"?"dshcs-cbtnPrimary":"dshcs-cbtnOutline"),disabled:e.disabled===!0,onClick:e.onClick},e.children)}function Ve(e){return l.createElement("label",{className:"dshcs-check"},l.createElement("input",{type:"checkbox",checked:e.checked===!0,disabled:e.disabled===!0,onChange:function(r){e.onChange(r.target.checked)}}),l.createElement("span",{className:"dshcs-hint"},e.children))}function Xe(e){var r=Array.isArray(e.options)?e.options:[];return l.createElement("label",{className:"dshcs-select"},l.createElement("select",{value:e.value,disabled:e.disabled===!0,onChange:function(t){e.onChange(t.target.value)}},r.map(function(t){return l.createElement("option",{key:t.value,value:t.value},t.label)})))}function ie(e){var r=[];return e.overridden===!0&&(r.push(l.createElement("span",{className:"dshcs-badge"},e.overriddenLabel)),r.push(l.createElement("button",{type:"button",className:"dshcs-reset",disabled:e.disabled===!0,onClick:e.onReset},e.resetLabel))),r.length===0?null:l.createElement("span",{className:"dshcs-badges"},...r)}function se(e){var[r,t]=l.useState(e.defaultOpen===!0),i=e.state;if(i==null||i.available!==!0)return null;var a=e.title,s=e.noticeOnly===!0,d=i.dirty!==!0||i.invalid===!0||i.saving===!0;return l.createElement("li",{className:"dshcs-card"+(r?" dshcs-cardOpen":"")},l.createElement("button",{type:"button",className:"dshcs-cardHeader","aria-expanded":r,onClick:function(){t(!r)}},l.createElement("span",{className:"dshcs-cardHeadText"},l.createElement("span",{className:"dshcs-cardName"},a),l.createElement("span",{className:"dshcs-cardDescription"},e.description)),i.dirty===!0?l.createElement("span",{className:"dshcs-pending"},e.unsavedLabel):null,l.createElement(Je,{className:"dshcs-cardChevron"+(r?" dshcs-cardChevronOpen":"")})),r===!0?l.createElement("div",{className:"dshcs-cardBody"},s===!0?null:i.writable!==!0?l.createElement("p",{className:"dshcs-cardReadOnly",role:"status"},e.readOnlyLabel):null,e.children,s===!0?null:l.createElement("div",{className:"dshcs-cardFooter"},i.failed===!0?l.createElement("p",{className:"dshcs-cardFailed",role:"status"},e.saveFailedLabel):null,l.createElement(le,{disabled:i.dirty!==!0||i.saving===!0,onClick:e.onDiscard},e.discardLabel),l.createElement(le,{variant:"primary",disabled:d,onClick:e.onSave},i.saving===!0?e.savingLabel:e.saveLabel))):null)}function Ke(e){try{let k=function(){E("/code-server/status").then(function(h){h!=null&&typeof h=="object"&&C({status:h})}).catch(function(){})};var r=e.scope,[t,i]=l.useState(function(){return r!==void 0?r.getSnapshot():null}),[a,s]=l.useState(null),[d,f]=l.useState(!1),[p,o]=l.useState(!1),c=B(),[v,y]=l.useState(q());if(l.useEffect(function(){return K(function(h){y(h)})},[]),l.useEffect(function(){if(r===void 0||typeof r.subscribe!="function")return;function h(){try{i(r.getSnapshot())}catch(nr){}}var x=r.subscribe(h);return function(){typeof x=="function"&&x()}},[r]),r===void 0)return console.error("[code-server] card scope missing"),null;if(t==null||t.status!=="ready")return t!=null&&t.status==="unavailable"&&console.warn("[code-server] settings scope unavailable:",t.status),null;var u=t.value!==void 0&&t.value!==null?t.value:{},m=t.user,b={keepResident:u.keepResident!==!1,fileOpenScope:u.fileOpenScope==="all"?"all":"session"};if(c!=null&&c.sidebarUi==="legacy")return l.createElement(se,{title:"Code Server",description:"\u5F53\u524D DSH \u7248\u672C\u4E0D\u53D7\u652F\u6301(\u7F3A\u5C11\u53F3\u4FA7\u680F\u670D\u52A1)",defaultOpen:!0,noticeOnly:!0,state:{available:!0,writable:!1,dirty:!1,invalid:!1,saving:!1,failed:!1}},l.createElement("div",{className:"dshcs-field"},l.createElement("div",{className:"dshcs-legacy"},"\u672C\u63D2\u4EF6\u81EA 0.2.3 \u8D77\u4E0D\u518D\u517C\u5BB9\u65E7\u7248 DSH\u3002"),l.createElement("div",{className:"dshcs-hint",style:{marginTop:0}},`\u672A\u68C0\u6D4B\u5230\u53F3\u4FA7\u680F\u63D2\u4EF6\u670D\u52A1 sidebarRightTabs / sidebarRight,\u56E0\u6B64\u63D2\u4EF6\u4E0D\u63D0\u4F9B\u4EFB\u4F55\u5165\u53E3(\u65E7\u7248\u7684\u60AC\u6D6E\u7403\u4E0E\u6D6E\u52A8\u7A97\u53E3\u5DF2\u79FB\u9664),\u4E5F\u4E0D\u4F1A\u540E\u53F0\u542F\u52A8 IDE\u3002
|
|
3
|
+
\u5347\u7EA7 DSH \u5230\u5E26\u53F3\u4FA7\u680F\u7684\u7248\u672C(\u2265 0.1.5-alpha.1)\u540E,Code Server \u4F1A\u51FA\u73B0\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC,\u672C\u9875\u540C\u65F6\u663E\u793A\u5B8C\u6574\u8BBE\u7F6E\u9879;\u5347\u7EA7\u540E\u65E0\u9700\u91CD\u88C5\u672C\u63D2\u4EF6,\u5237\u65B0\u9875\u9762\u5373\u53EF\u3002`)));var g=m!=null&&Object.prototype.hasOwnProperty.call(m,"keepResident"),w=m!=null&&Object.prototype.hasOwnProperty.call(m,"fileOpenScope"),S=a!==null&&(a.keepResident!==b.keepResident||a.fileOpenScope!==b.fileOpenScope),F=!S||d,ce={available:!0,writable:t.writable,dirty:S,invalid:!1,saving:d,failed:p};async function ue(){if(S&&!d){f(!0),o(!1);try{var h=a!==null?a:b;await e.scope.set("keepResident",h.keepResident===!0),await e.scope.set("fileOpenScope",h.fileOpenScope==="all"?"all":"session"),s(null),k()}catch(x){o(!0)}f(!1)}}async function G(){if(!(d||t.writable!==!0)){f(!0),o(!1);try{typeof e.scope.unset=="function"?(await e.scope.unset("keepResident"),await e.scope.unset("fileOpenScope")):(await e.scope.set("keepResident",u.keepResident===void 0||u.keepResident===null?!0:u.keepResident),await e.scope.set("fileOpenScope",u.fileOpenScope==="all"?"all":"session")),s(null),k()}catch(h){o(!0)}f(!1)}}return l.createElement(se,{title:"Code Server",description:"\u5165\u53E3:\u53F3\u4FA7\u680F\u6807\u7B7E(DSH \u2265 0.1.5-alpha.1);\u8BA4\u9886\u8303\u56F4\u51B3\u5B9A\u54EA\u4E9B\u6587\u4EF6\u4EA4\u7ED9 Code Server \u6253\u5F00",state:ce,unsavedLabel:"\u672A\u4FDD\u5B58",readOnlyLabel:"\u672C\u90E8\u7F72\u7684\u8BBE\u7F6E\u4E3A\u53EA\u8BFB\u3002",saveFailedLabel:"\u672C\u90E8\u7F72\u6CA1\u6709\u63A5\u53D7\u8FD9\u4E9B\u503C\uFF0C\u5DF2\u4FDD\u7559\u4F9B\u4F60\u4FEE\u6539\u3002",discardLabel:"\u653E\u5F03\u4FEE\u6539",saveLabel:"\u4FDD\u5B58",savingLabel:"\u4FDD\u5B58\u4E2D\u2026",onSave:ue,onDiscard:function(){s(null),o(!1)}},l.createElement("div",{className:"dshcs-field"},l.createElement("div",{className:"dshcs-fieldHead"},l.createElement("span",{className:"dshcs-fieldLabel"},"\u8BA4\u9886\u8303\u56F4(\u54EA\u4E9B\u6587\u4EF6\u4EA4\u7ED9 Code Server)"),w===!0?l.createElement(ie,{overridden:!0,disabled:t.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){G()}}):null),l.createElement(Xe,{value:a!==null?a.fileOpenScope:b.fileOpenScope,disabled:t.writable!==!0,options:[{value:"session",label:"\u4EC5\u4F1A\u8BDD\u5185\u6587\u4EF6(\u63A8\u8350)"},{value:"all",label:"\u6240\u6709\u6587\u4EF6(\u542B\u5DE5\u4F5C\u533A\u5916\u7684\u7EDD\u5BF9\u8DEF\u5F84)"}],onChange:function(h){s(function(x){return Object.assign({},x!==null?x:b,{fileOpenScope:h==="all"?"all":"session"})}),o(!1)}}),l.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},"\u4F1A\u8BDD\u5185\u6587\u4EF6 = DSH \u7528 `dsh-resource://file/session/\u2026` \u547D\u540D\u7684\u6587\u4EF6(\u4EA7\u7269\u3001\u4EA4\u4ED8\u3001\u6B63\u6587\u63D0\u53CA\u3001\u5DE5\u5177\u89C6\u56FE);\u201C\u6240\u6709\u6587\u4EF6\u201D\u8FD8\u4F1A\u8BA4\u9886\u4E0D\u5E26\u4F1A\u8BDD\u7684\u7EDD\u5BF9\u8DEF\u5F84 `dsh-resource://file/absolute/\u2026`\u3002\u672A\u88AB\u8BA4\u9886\u7684\u5730\u5740\u7531 DSH \u81EA\u5E26\u9884\u89C8\u515C\u5E95\u3002")),l.createElement("div",{className:"dshcs-field"},l.createElement("div",{className:"dshcs-fieldHead"},l.createElement("span",{className:"dshcs-fieldLabel"},"\u540E\u53F0\u5E38\u9A7B(\u5207\u6807\u7B7E\u4E0D\u91CD\u8F7D)"),g===!0?l.createElement(ie,{overridden:!0,disabled:t.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){G()}}):null),l.createElement(Ve,{checked:a!==null?a.keepResident:b.keepResident,disabled:t.writable!==!0,onChange:function(h){s(function(x){return Object.assign({},x!==null?x:b,{keepResident:h===!0})}),o(!1)}},'\u5F00\u542F\u540E\u5BBF\u4E3B\u542F\u52A8\u5373\u628A IDE \u52A0\u8F7D\u5230\u540E\u53F0"\u505C\u653E\u533A":\u5207\u6362\u53F3\u4FA7\u680F\u6807\u7B7E\u3001\u6536\u8D77/\u5C55\u5F00\u4FA7\u680F\u3001\u62D6\u6210\u6D6E\u52A8\u7A97\u53E3\u90FD\u4E0D\u518D\u91CD\u8F7D,\u9996\u6B21\u6253\u5F00\u514D\u7B49\u5F85;\u5173\u95ED\u5219\u53EA\u5728\u6253\u5F00\u9762\u677F\u65F6\u52A0\u8F7D(\u7701\u5185\u5B58)'),l.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},N?"\u5E38\u9A7B\u9762:"+(v.docked?"\u5DF2\u505C\u9760":v.ready?"\u5DF2\u505C\u653E(\u540E\u53F0\u8FD0\u884C\u4E2D)":"\u672A\u542F\u52A8")+(v.degraded?" \xB7 \u672C\u6B21\u53D1\u751F\u8FC7\u964D\u7EA7\u91CD\u8F7D":""):"\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 Element.moveBefore(Chromium <133)\u2192 \u5E38\u9A7B\u4E0D\u53EF\u7528,\u5207\u6807\u7B7E\u4ECD\u4F1A\u6574\u9875\u91CD\u8F7D(\u5347\u7EA7\u6D4F\u89C8\u5668\u540E\u81EA\u52A8\u751F\u6548)")))}catch(k){return console.error("[code-server] card render error:",k!=null&&k.message!==void 0?k.message:String(k)),null}}function qe(e){try{$e(e)}catch(r){console.error("[code-server] apply failed:",r&&r.stack?r.stack:String(r));try{document.title="CS-ERR "+(r&&r.message||String(r))}catch(t){}}}function $e(e){var r=e.get("slots");if(r===void 0){console.error("[code-server] slots service unavailable");return}var t=e.settingsScope,i=null;if(t!==void 0&&typeof t.bind=="function")i=t.bind({namespace:"code-server"});else{console.error("[code-server] settingsScope unavailable (inject missing?); settings card disabled");return}E("/code-server/status").then(function(u){C({status:u})}).catch(function(){}),r.inject("settings.plugin.item",()=>r.register({name:"settings.plugin.item",key:"code-server",label:"Code Server",inject:function(){return{scope:i}}},Ke));var a=!1;function s(u,m){if(!a){a=!0,c();var b=!1;try{b=Qe(u)}catch(g){console.error("[code-server] sidebar tab registration failed:",g!=null&&g.message!=null?g.message:String(g))}L.sidebarUi==="legacy"&&(console.log("[code-server] \u53F3\u4FA7\u680F\u670D\u52A1\u665A\u5230(\u7ECF "+m+"):\u64A4\u9500\u65E7\u7248 DSH \u5224\u5B9A"),E("/code-server/ui-mode",{sidebar:!0}).catch(function(){})),C({sidebarUi:"modern",sidebarRegisterFailed:b!==!0}),r.inject("shell.overlay",()=>r.register({name:"shell.overlay",id:"code-server",order:70,label:"Code Server"},g=>l.createElement(ze,g))),console.log("[code-server] client registered via "+m+": sidebar tab="+b+"(claims dsh-resource://file/**) + resident preload + settings card")}}function d(u){C({sidebarUi:"legacy"}),console.warn("[code-server] \u672A\u63A2\u6D4B\u5230\u53F3\u4FA7\u680F\u670D\u52A1(sidebarRightTabs/sidebarRight): \u672C\u63D2\u4EF6\u81EA 0.2.3 \u8D77\u4E0D\u518D\u517C\u5BB9\u65E7\u7248 DSH \u2014\u2014 \u9664\u300C\u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Code Server\u300D\u7684\u63D0\u793A\u5916\u4E0D\u63D0\u4F9B\u4EFB\u4F55\u5165\u53E3,\u4E5F\u4E0D\u9884\u70ED IDE\u3002\u8BF7\u5347\u7EA7 DSH\u3002"),u===!0&&E("/code-server/ui-mode",{sidebar:!1}).catch(function(){})}var f=null,p=null,o=null;function c(){f!==null&&(clearTimeout(f),f=null),p!==null&&(clearTimeout(p),p=null),o!==null&&(clearTimeout(o),o=null)}var v=!1;try{typeof e.inject=="function"&&(v=!0,e.inject(["sidebarRightTabs","sidebarRight"],function(u){s(u,"inject")}))}catch(u){console.warn("[code-server] sidebar inject failed:",u!=null&&u.message!=null?u.message:String(u))}var y=typeof e.get=="function"&&e.get("sidebarRightTabs")!==void 0&&e.get("sidebarRight")!==void 0;if(y){o=setTimeout(function(){a||(console.warn("[code-server] ctx.inject \u672A\u5728 1.5s \u5185\u56DE\u8C03,\u6539\u7528\u540C\u6B65\u670D\u52A1\u6CE8\u518C\u4FA7\u680F"),s(e,"sync-fallback"))},He);return}if(v!==!0){d(!0);return}f=setTimeout(function(){a||d(!1)},Pe),p=setTimeout(function(){a||d(!0)},Ue)}var er=["slots","settingsScope"],rr="code-server";
|
|
4
4
|
return module.exports;}});
|
|
5
|
+
|
package/lib/index.js
CHANGED
|
@@ -126,6 +126,15 @@ function win32() {
|
|
|
126
126
|
return process.platform === 'win32';
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
/** 本插件的 package.json 版本(?v= 缓存击穿标记用;读不到就退回 'dev')。 */
|
|
130
|
+
function pluginVersion() {
|
|
131
|
+
try {
|
|
132
|
+
return JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT, 'package.json'), 'utf8')).version ?? 'dev';
|
|
133
|
+
} catch {
|
|
134
|
+
return 'dev';
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
129
138
|
/** 插件自带 launcher(<pkg>/lib/launcher.mjs);它直接驱动 VS Code server(0.2.0 模型)。 */
|
|
130
139
|
function launcherPath() {
|
|
131
140
|
return path.join(path.dirname(fileURLToPath(import.meta.url)), 'launcher.mjs');
|
|
@@ -627,7 +636,18 @@ export async function apply(ctx, config) {
|
|
|
627
636
|
}, 500);
|
|
628
637
|
}
|
|
629
638
|
|
|
630
|
-
|
|
639
|
+
/** 启动串行化:apply 期的**预启动**与界面点击的启动可能并发,而两者写同一份 pid.json、
|
|
640
|
+
* 抢同一个端口 —— 并发进入会双开 launcher(第二个绑不上端口 ⇒ 状态被顶成 error,
|
|
641
|
+
* 表现为"点一下启动就报端口被占用")。串成一条链后,第二个调用会看到 running/starting
|
|
642
|
+
* 并按既有逻辑复用。 */
|
|
643
|
+
let startChain = Promise.resolve();
|
|
644
|
+
function start(cwdArg) {
|
|
645
|
+
const run = startChain.then(() => startInner(cwdArg), () => startInner(cwdArg));
|
|
646
|
+
startChain = run.then(() => {}, () => {});
|
|
647
|
+
return run;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
async function startInner(cwdArg) {
|
|
631
651
|
const cwd = typeof cwdArg === 'string' && cwdArg.trim() !== '' ? cwdArg : undefined;
|
|
632
652
|
if (state.status === 'running' && state.pid !== null) {
|
|
633
653
|
if (cwd === undefined || cwd === state.cwd) return snapshot();
|
|
@@ -733,6 +753,9 @@ export async function apply(ctx, config) {
|
|
|
733
753
|
const env = { ...process.env };
|
|
734
754
|
// 内置扩展信号文件路径(host → 扩展 打开文件)
|
|
735
755
|
env.DSHCS_OPEN_FILE_SIGNAL = openFileSignalPath(userDataDir);
|
|
756
|
+
// ?v= 缓存击穿标记:按"插件版本 + VS Code 树"生成 —— 只在真升级时让渲染器丢掉旧 bundle,
|
|
757
|
+
// 平时正常命中缓存(workbench.js 有 18MB,每次启动都重拉不划算)。
|
|
758
|
+
env.DSHCS_HTML_TAG = `${pluginVersion()}-${productPath() ?? 'dev'}`.replace(/[^A-Za-z0-9._-]/g, '');
|
|
736
759
|
// pnpm 会把带 os/cpu 限定的原生包嵌套装在平台聚合包下(如 <profile>/node_modules/@<scope>/
|
|
737
760
|
// dsh-code-server-runtime-<平台>-<架构>/node_modules/@vscode/spdlog),那些目录不在 VS Code
|
|
738
761
|
// 树的向上查找链里 → 用 NODE_PATH 让子进程的 require 找得到(CJS;ESM 由 ensureAliasLinks 的 junction 负责)。
|