planx 20.86.1 → 20.88.0

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/explorer.main.mjs CHANGED
@@ -1,4 +1,4 @@
1
- globalThis.__PLANX_SERVICE_VERSION__="20.86.1";
1
+ globalThis.__PLANX_SERVICE_VERSION__="20.88.0";
2
2
  import*as _e from"fs";import{dirname as jt,join as Ut}from"path";function Z(e,t){let r=e[t];if(!r)throw new Error(`explorer child \u306E\u8D77\u52D5\u306B ${t} \u304C\u5FC5\u8981\u3067\u3059`);return r}function $e(e=process.env){let t=Number(e.PLANX_EXPLORER_LEASE_MS??"");return{port:Number(e.PORT??0),portFile:e.PLANX_EXPLORER_PORT_FILE,pidFile:e.PLANX_EXPLORER_PID_FILE,sessionPortFile:Z(e,"PLANX_SESSION_PORT_FILE"),domainPortFile:e.PLANX_DOMAIN_PORT_FILE??Ut(jt(Z(e,"PLANX_SESSION_PORT_FILE")),"domain.port"),filesystemPortFile:Z(e,"PLANX_FILESYSTEM_PORT_FILE"),...Number.isInteger(t)&&t>0?{leaseMs:t}:{}}}import{existsSync as Bt,readFileSync as Wt}from"fs";function k(e,t){if(!Bt(e))throw new Error(`${t} \u304C\u8D77\u52D5\u3057\u3066\u3044\u307E\u305B\u3093: ${e} \u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093`);let r=Number(Wt(e,"utf-8").trim());if(!Number.isInteger(r)||r<=0)throw new Error(`${t} \u306E port file \u304C\u4E0D\u6B63\u3067\u3059: ${e}`);return r}import{readFileSync as qt}from"fs";var Gt=250,Kt=e=>new Promise(t=>setTimeout(t,e)),ee=class extends Error{constructor(r,n){super(r);this.status=n;this.name="DoRequestError"}};async function Jt(e,t){if(!e.ok)throw new ee(`${t} \u306B\u5931\u6557\u3057\u307E\u3057\u305F (${e.status}): ${await e.text()}`,e.status)}async function Me(e){let t=e.sleep??Kt,r=qt(e.bundlePath,"utf-8"),n=null;for(let o=1;o<=(e.attempts??30);o+=1)try{let s=e.deployUrl(),i=await fetch(s,{method:"POST",headers:e.headers,body:r});await Jt(i,"explorer plugin \u306E install");return}catch(s){n=s,await t(Gt*4)}throw n}function te(e){try{return new URL(e).pathname}catch{return""}}function N(e){let t=te(e);return t?t.endsWith("/")?t:t.slice(0,t.lastIndexOf("/")+1):""}var He=10,re=`http://127.0.0.1:${He}`,ke="x-planx-session-id";function j(e){try{return new URL(e).port===String(He)}catch{return!1}}function ne(e,t){return!t||!e.startsWith(t)?e:re+e.slice(t.length)}function Xt(e){if(e)return`${re}${e.endsWith("/")?e:`${e}/`}`}async function Vt(e,t){let r=new Set(e.map(i=>i.id)),n=new Set(t.sessionIds()),o=[...n].filter(i=>!r.has(i)).map(i=>t.detach(i)),s=e.filter(i=>!n.has(i.id)).map(i=>t.attach(i.id,{home:Xt(i.cwd)}));await Promise.all([...o,...s].map(i=>i.catch(a=>t.onError?.(a))))}async function*zt(e){let t=e.getReader(),r=new TextDecoder,n="";for(;;){let{done:o,value:s}=await t.read();if(o)return;n+=r.decode(s,{stream:!0});let i=n.indexOf(`
3
3
 
4
4
  `);for(;i>=0;){let a=n.slice(0,i).split(`