sliccy 1.0.1 → 1.0.2
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.md +98 -445
- package/dist/cli/index.js +24 -6
- package/dist/ui/assets/{___vite-browser-external_commonjs-proxy-7ULRRj69.js → ___vite-browser-external_commonjs-proxy-DI43bbQw.js} +1 -1
- package/dist/ui/assets/{bsh-watchdog-D19WB0U1.js → bsh-watchdog-uk_ACjOz.js} +1 -1
- package/dist/ui/assets/{index-C1dglHrI.js → index-9crYr7pn.js} +1 -1
- package/dist/ui/assets/{index-DvjzakYY.js → index-C1lgMSN2.js} +938 -934
- package/dist/ui/assets/{index-deZeJCgO.js → index-COMQCYh-.js} +1 -1
- package/dist/ui/assets/{index-DEglHp2j.js → index-ChxPM3KL.js} +1 -1
- package/dist/ui/assets/{index-D8uSC2sl.js → index-DJA4jgWl.js} +1 -1
- package/dist/ui/assets/{index-BVQAdk-Y.js → index-DxLOLOfX.js} +1 -1
- package/dist/ui/assets/{index-mz3VYh0I.js → index-bo18OtLo.js} +1 -1
- package/dist/ui/assets/{index-ygVJ3eFG.js → index-g_Oj1Xd7.js} +1 -1
- package/dist/ui/assets/{index-r2m8Dpaz.js → index-xzVzlu9M.js} +1 -1
- package/dist/ui/assets/{offscreen-client-ByVIJGHW.js → offscreen-client-B_ASD-T8.js} +1 -1
- package/dist/ui/assets/{sql-wasm-BggYNCID.js → sql-wasm-8C3CnQsV.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +2 -2
package/dist/cli/index.js
CHANGED
|
@@ -81,26 +81,44 @@ function pipeChildOutput(child, label) {
|
|
|
81
81
|
// ---------------------------------------------------------------------------
|
|
82
82
|
// Port selection — tries the preferred port, falls back to OS-assigned
|
|
83
83
|
// ---------------------------------------------------------------------------
|
|
84
|
-
function tryListenOnPort(port) {
|
|
84
|
+
function tryListenOnPort(port, host) {
|
|
85
85
|
return new Promise((resolve, reject) => {
|
|
86
86
|
const server = createNetServer();
|
|
87
87
|
server.on('error', reject);
|
|
88
|
-
|
|
89
|
-
// on 127.0.0.1, so checking on 0.0.0.0/:: would miss the conflict.
|
|
90
|
-
server.listen(port, '127.0.0.1', () => {
|
|
88
|
+
server.listen(port, host, () => {
|
|
91
89
|
const addr = server.address();
|
|
92
90
|
const assignedPort = addr && typeof addr === 'object' ? addr.port : port;
|
|
93
91
|
server.close(() => resolve(assignedPort));
|
|
94
92
|
});
|
|
95
93
|
});
|
|
96
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Check that a port is free on both IPv4 (127.0.0.1) and IPv6 (::1).
|
|
97
|
+
* On macOS, `localhost` resolves to `::1`, so a server bound only on
|
|
98
|
+
* 127.0.0.1 is invisible to browsers connecting via `localhost`.
|
|
99
|
+
* Checking both address families avoids dual-stack port conflicts
|
|
100
|
+
* (e.g. a stale Vite process on `::1` while Express binds `127.0.0.1`).
|
|
101
|
+
*/
|
|
102
|
+
async function tryListenOnPortDualStack(port) {
|
|
103
|
+
const assignedPort = await tryListenOnPort(port, '127.0.0.1');
|
|
104
|
+
try {
|
|
105
|
+
await tryListenOnPort(assignedPort, '::1');
|
|
106
|
+
}
|
|
107
|
+
catch (err) {
|
|
108
|
+
if (err.code === 'EADDRINUSE') {
|
|
109
|
+
throw Object.assign(new Error(`Port ${assignedPort} in use on IPv6`), { code: 'EADDRINUSE' });
|
|
110
|
+
}
|
|
111
|
+
// ::1 may not be available on some systems — ignore non-EADDRINUSE errors
|
|
112
|
+
}
|
|
113
|
+
return assignedPort;
|
|
114
|
+
}
|
|
97
115
|
async function findAvailablePort(preferred) {
|
|
98
116
|
try {
|
|
99
|
-
return await
|
|
117
|
+
return await tryListenOnPortDualStack(preferred);
|
|
100
118
|
}
|
|
101
119
|
catch (err) {
|
|
102
120
|
if (err.code === 'EADDRINUSE') {
|
|
103
|
-
return tryListenOnPort(0);
|
|
121
|
+
return tryListenOnPort(0, '127.0.0.1');
|
|
104
122
|
}
|
|
105
123
|
throw err;
|
|
106
124
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e}from"./__vite-browser-external-D7Ct-6yo.js";import{g as r}from"./index-
|
|
1
|
+
import{_ as e}from"./__vite-browser-external-D7Ct-6yo.js";import{g as r}from"./index-C1lgMSN2.js";const a=r(e);export{a as r};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as u}from"./index-
|
|
1
|
+
import{c as u}from"./index-C1lgMSN2.js";const l=["/workspace","/shared"];async function d(s){const t=[],e=new Set;for(const r of l)await s.exists(r)&&await p(s,r,t,e);return t}async function p(s,t,e,r){for await(const n of s.walk(t)){if(!n.endsWith(".bsh")||r.has(n))continue;r.add(n);const i=g(n);if(!i)continue;const a=await s.readFile(n,{encoding:"utf-8"}),c=typeof a=="string"?a:new TextDecoder().decode(a),f=m(c);e.push({path:n,hostnamePattern:i,matchPatterns:f})}}function g(s){const t=s.split("/").pop()??"";if(!t.endsWith(".bsh"))return null;const e=t.slice(0,-4);return e?e.startsWith("-.")?"*"+e.slice(1):e:null}function m(s){const t=s.split(`
|
|
2
2
|
`).slice(0,10),e=[];for(const r of t){const n=r.match(/^\s*\/\/\s*@match\s+(.+)$/);n&&e.push(n[1].trim())}return e}function h(s,t){if(t.startsWith("*.")){const e=t.slice(1);return s.endsWith(e)&&s.length>e.length}return s===t}function v(s,t){try{const e=new URL(s),r=t.match(/^(\*|https?):\/\/([^/]+)(\/.*)?$/);if(!r)return!1;const[,n,i,a]=r;return n!=="*"&&e.protocol.slice(0,-1)!==n||!h(e.hostname,i)?!1:a?x(e.pathname+e.search,a):!0}catch{return!1}}function x(s,t){const e="^"+t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(e).test(s)}function w(s,t){try{const e=new URL(t);return s.filter(r=>h(e.hostname,r.hostnamePattern)?r.matchPatterns.length>0?r.matchPatterns.some(n=>v(t,n)):!0:!1)}catch{return[]}}const o=u("bsh-watchdog");class S{transport;fs;execute;discoveryIntervalMs;entries=[];discoveryTimer=null;running=!1;executing=new Set;constructor(t){this.transport=t.transport,this.fs=t.fs,this.execute=t.execute,this.discoveryIntervalMs=t.discoveryIntervalMs??3e4}async start(){this.running||(this.running=!0,await this.discover(),this.discoveryTimer=setInterval(()=>{this.discover()},this.discoveryIntervalMs),this.transport.on("Page.frameNavigated",this.onFrameNavigated),o.info("BSH watchdog started",{scriptCount:this.entries.length}))}stop(){this.running&&(this.running=!1,this.transport.off("Page.frameNavigated",this.onFrameNavigated),this.discoveryTimer&&(clearInterval(this.discoveryTimer),this.discoveryTimer=null),this.entries=[],this.executing.clear(),o.info("BSH watchdog stopped"))}async discover(){try{this.entries=await d(this.fs),o.debug("BSH discovery complete",{count:this.entries.length})}catch(t){o.error("BSH discovery failed",{error:t instanceof Error?t.message:String(t)})}}getEntries(){return this.entries}onFrameNavigated=t=>{const e=t.frame;if(e?.parentId||!e?.url)return;const r=e.url;if(!r.startsWith("http://")&&!r.startsWith("https://")||this.entries.length===0)return;const n=w(this.entries,r);if(n.length!==0)for(const i of n){const a=`${i.path}::${r}`;this.executing.has(a)||(this.executing.add(a),o.info("BSH watchdog executing script",{script:i.path,url:r}),this.execute(i.path).then(c=>{c.exitCode!==0?o.warn("BSH script failed",{script:i.path,url:r,exitCode:c.exitCode,stderr:c.stderr.slice(0,200)}):o.info("BSH script completed",{script:i.path,url:r})}).catch(c=>{o.error("BSH script execution error",{script:i.path,url:r,error:c instanceof Error?c.message:String(c)})}).finally(()=>{this.executing.delete(a)}))}}}export{S as BshWatchdog};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as B,o as W}from"./index-
|
|
1
|
+
import{n as B,o as W}from"./index-C1lgMSN2.js";import{R as j,A as P,a as D,r as $,b as F,W as K}from"./stream-lEC9OYG2.js";const V=["ECONNRESET","EPIPE","ETIMEDOUT"],z=r=>{const e={};for(const t of Object.keys(r)){const n=r[t];e[t]=Array.isArray(n)?n.join(","):n}return e},l={setTimeout:(r,e)=>setTimeout(r,e),clearTimeout:r=>clearTimeout(r)},H=1e3,q=(r,e,t=0)=>{if(!t)return-1;const n=s=>{const i=l.setTimeout(()=>{r.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${t} ms.`),{name:"TimeoutError"}))},t-s),o=a=>{a?.connecting?a.on("connect",()=>{l.clearTimeout(i)}):l.clearTimeout(i)};r.socket?o(r.socket):r.on("socket",o)};return t<2e3?(n(0),0):l.setTimeout(n.bind(null,H),H)},Q=(r,e,t=0,n,s)=>t?l.setTimeout(()=>{let i=`@smithy/node-http-handler - [${n?"ERROR":"WARN"}] a request has exceeded the configured ${t} ms requestTimeout.`;if(n){const o=Object.assign(new Error(i),{name:"TimeoutError",code:"ETIMEDOUT"});r.destroy(o),e(o)}else i+=" Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.",s?.warn?.(i)},t):-1,J=3e3,G=(r,{keepAlive:e,keepAliveMsecs:t},n=J)=>{if(e!==!0)return-1;const s=()=>{r.socket?r.socket.setKeepAlive(e,t||0):r.on("socket",i=>{i.setKeepAlive(e,t||0)})};return n===0?(s(),0):l.setTimeout(s,n)},U=3e3,X=(r,e,t=0)=>{const n=s=>{const i=t-s,o=()=>{r.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${t} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}))};r.socket?(r.socket.setTimeout(i,o),r.on("close",()=>r.socket?.removeListener("timeout",o))):r.setTimeout(i,o)};return 0<t&&t<6e3?(n(0),0):l.setTimeout(n.bind(null,t===0?0:U),U)},N=6e3;async function I(r,e,t=N,n=!1){const s=e.headers??{},i=s.Expect||s.expect;let o=-1,a=!0;!n&&i==="100-continue"&&(a=await Promise.race([new Promise(c=>{o=Number(l.setTimeout(()=>c(!0),Math.max(N,t)))}),new Promise(c=>{r.on("continue",()=>{l.clearTimeout(o),c(!0)}),r.on("response",()=>{l.clearTimeout(o),c(!1)}),r.on("error",()=>{l.clearTimeout(o),c(!1)})})])),a&&Y(r,e.body)}function Y(r,e){if(e instanceof j){e.pipe(r);return}if(e){const t=Buffer.isBuffer(e);if(t||typeof e=="string"){t&&e.byteLength===0?r.end():r.end(e);return}const s=e;if(typeof s=="object"&&s.buffer&&typeof s.byteOffset=="number"&&typeof s.byteLength=="number"){r.end(Buffer.from(s.buffer,s.byteOffset,s.byteLength));return}r.end(Buffer.from(e));return}r.end()}const fe=0;class L{config;configProvider;socketWarningTimestamp=0;externalAgent=!1;metadata={handlerProtocol:"http/1.1"};static create(e){return typeof e?.handle=="function"?e:new L(e)}static checkSocketUsage(e,t,n=console){const{sockets:s,requests:i,maxSockets:o}=e;if(typeof o!="number"||o===1/0||Date.now()-15e3<t)return t;if(s&&i)for(const c in s){const h=s[c]?.length??0,d=i[c]?.length??0;if(h>=o&&d>=2*o)return n?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${h} and ${d} additional requests are enqueued.
|
|
2
2
|
See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
|
|
3
3
|
or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return t}constructor(e){this.configProvider=new Promise((t,n)=>{typeof e=="function"?e().then(s=>{t(this.resolveDefaultConfig(s))}).catch(n):t(this.resolveDefaultConfig(e))})}resolveDefaultConfig(e){const{requestTimeout:t,connectionTimeout:n,socketTimeout:s,socketAcquisitionWarningTimeout:i,httpAgent:o,httpsAgent:a,throwOnRequestTimeout:c,logger:h}=e||{},d=!0,T=50;return{connectionTimeout:n,requestTimeout:t,socketTimeout:s,socketAcquisitionWarningTimeout:i,throwOnRequestTimeout:c,httpAgent:o instanceof D||typeof o?.destroy=="function"?(this.externalAgent=!0,o):new D({keepAlive:d,maxSockets:T,...o}),httpsAgent:a instanceof P||typeof a?.destroy=="function"?(this.externalAgent=!0,a):new P({keepAlive:d,maxSockets:T,...a}),logger:h}}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:t,requestTimeout:n}={}){return this.config||(this.config=await this.configProvider),new Promise((s,i)=>{const o=this.config;let a;const c=[],h=async u=>{await a,c.forEach(l.clearTimeout),i(u)};if(t?.aborted){const u=new Error("Request aborted");u.name="AbortError",h(u);return}const d=e.protocol==="https:",T=e.headers??{},S=(T.Expect??T.expect)==="100-continue";let b=d?o.httpsAgent:o.httpAgent;S&&!this.externalAgent&&(b=new(d?P:D)({keepAlive:!1,maxSockets:1/0})),c.push(l.setTimeout(()=>{this.socketWarningTimestamp=L.checkSocketUsage(b,this.socketWarningTimestamp,o.logger)},o.socketAcquisitionWarningTimeout??(o.requestTimeout??2e3)+(o.connectionTimeout??1e3)));const v=B(e.query||{});(e.username!=null||e.password!=null)&&(e.username,e.password);let C=e.path;v&&(C+=`?${v}`),e.fragment&&(C+=`#${e.fragment}`);let w=e.hostname??"";w[0]==="["&&w.endsWith("]")?w=e.hostname.slice(1,-1):w=e.hostname;const k={headers:e.headers,method:e.method,port:e.port,agent:b},y=(d?$:F)();if(y.on("error",u=>{V.includes(u.code)?h(Object.assign(u,{name:"TimeoutError"})):h(u)}),t){const u=()=>{y.destroy();const p=new Error("Request aborted");p.name="AbortError",h(p)};if(typeof t.addEventListener=="function"){const p=t;p.addEventListener("abort",u,{once:!0}),y.once("close",()=>p.removeEventListener("abort",u))}else t.onabort=u}const A=n??o.requestTimeout;c.push(q(y,h,o.connectionTimeout)),c.push(Q(y,h,A,o.throwOnRequestTimeout,o.logger??console)),c.push(X(y,h,o.socketTimeout));const m=k.agent;typeof m=="object"&&"keepAlive"in m&&c.push(G(y,{keepAlive:m.keepAlive,keepAliveMsecs:m.keepAliveMsecs})),a=I(y,e,A,this.externalAgent).catch(u=>(c.forEach(l.clearTimeout),i(u)))})}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(n=>({...n,[e]:t}))}httpHandlerConfigs(){return this.config??{}}}const _={};function Z(){throw new Error("http2.createServer is not available in the browser")}function ee(){throw new Error("http2.connect is not available in the browser")}const te={constants:_,createServer:Z,connect:ee};class ne{sessions=[];constructor(e){this.sessions=e??[]}poll(){if(this.sessions.length>0)return this.sessions.shift()}offerLast(e){this.sessions.push(e)}contains(e){return this.sessions.includes(e)}remove(e){this.sessions=this.sessions.filter(t=>t!==e)}[Symbol.iterator](){return this.sessions[Symbol.iterator]()}destroy(e){for(const t of this.sessions)t===e&&(t.destroyed||t.destroy())}}class oe{constructor(e){if(this.config=e,this.config.maxConcurrency&&this.config.maxConcurrency<=0)throw new RangeError("maxConcurrency must be greater than zero.")}config;sessionCache=new Map;lease(e,t){const n=this.getUrlString(e),s=this.sessionCache.get(n);if(s){const c=s.poll();if(c&&!this.config.disableConcurrency)return c}const i=te.connect(n);this.config.maxConcurrency&&i.settings({maxConcurrentStreams:this.config.maxConcurrency},c=>{if(c)throw new Error("Fail to set maxConcurrentStreams to "+this.config.maxConcurrency+"when creating new session for "+e.destination.toString())}),i.unref();const o=()=>{i.destroy(),this.deleteSession(n,i)};i.on("goaway",o),i.on("error",o),i.on("frameError",o),i.on("close",()=>this.deleteSession(n,i)),t.requestTimeout&&i.setTimeout(t.requestTimeout,o);const a=this.sessionCache.get(n)||new ne;return a.offerLast(i),this.sessionCache.set(n,a),i}deleteSession(e,t){const n=this.sessionCache.get(e);n&&n.contains(t)&&(n.remove(t),this.sessionCache.set(e,n))}release(e,t){const n=this.getUrlString(e);this.sessionCache.get(n)?.offerLast(t)}destroy(){for(const[e,t]of this.sessionCache){for(const n of t)n.destroyed||n.destroy(),t.remove(n);this.sessionCache.delete(e)}}setMaxConcurrentStreams(e){if(e&&e<=0)throw new RangeError("maxConcurrentStreams must be greater than zero.");this.config.maxConcurrency=e}setDisableConcurrentStreams(e){this.config.disableConcurrency=e}getUrlString(e){return e.destination.toString()}}class M{config;configProvider;metadata={handlerProtocol:"h2"};connectionManager=new oe({});static create(e){return typeof e?.handle=="function"?e:new M(e)}constructor(e){this.configProvider=new Promise((t,n)=>{typeof e=="function"?e().then(s=>{t(s||{})}).catch(n):t(e||{})})}destroy(){this.connectionManager.destroy()}async handle(e,{abortSignal:t,requestTimeout:n}={}){this.config||(this.config=await this.configProvider,this.connectionManager.setDisableConcurrentStreams(this.config.disableConcurrentStreams||!1),this.config.maxConcurrentStreams&&this.connectionManager.setMaxConcurrentStreams(this.config.maxConcurrentStreams));const{requestTimeout:s,disableConcurrentStreams:i}=this.config,o=n??s;return new Promise((a,c)=>{let h=!1,d;const T=async f=>{await d,a(f)},S=async f=>{await d,c(f)};if(t?.aborted){h=!0;const f=new Error("Request aborted");f.name="AbortError",S(f);return}const{hostname:b,method:v,port:C,protocol:w,query:k}=e;let x="";if(e.username!=null||e.password!=null){const f=e.username??"",E=e.password??"";x=`${f}:${E}@`}const y=`${w}//${x}${b}${C?`:${C}`:""}`,A={destination:new URL(y)},m=this.connectionManager.lease(A,{requestTimeout:this.config?.sessionTimeout,disableConcurrentStreams:i||!1}),u=f=>{i&&this.destroySession(m),h=!0,S(f)},p=B(k||{});let R=e.path;p&&(R+=`?${p}`),e.fragment&&(R+=`#${e.fragment}`);const g=m.request({...e.headers,[_.HTTP2_HEADER_PATH]:R,[_.HTTP2_HEADER_METHOD]:v});if(m.ref(),g.on("response",f=>{const E=new W({statusCode:f[":status"]||-1,headers:z(f),body:g});h=!0,T({response:E}),i&&(m.close(),this.connectionManager.deleteSession(y,m))}),o&&g.setTimeout(o,()=>{g.close();const f=new Error(`Stream timed out because of no activity for ${o} ms`);f.name="TimeoutError",u(f)}),t){const f=()=>{g.close();const E=new Error("Request aborted");E.name="AbortError",u(E)};if(typeof t.addEventListener=="function"){const E=t;E.addEventListener("abort",f,{once:!0}),g.once("close",()=>E.removeEventListener("abort",f))}else t.onabort=f}g.on("frameError",(f,E,O)=>{u(new Error(`Frame type id ${f} in stream id ${O} has failed with code ${E}.`))}),g.on("error",u),g.on("aborted",()=>{u(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${g.rstCode}.`))}),g.on("close",()=>{m.unref(),i&&m.destroy(),h||u(new Error("Unexpected error: http2 request did not get a response"))}),d=I(g,e,o)})}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(n=>({...n,[e]:t}))}httpHandlerConfigs(){return this.config??{}}destroySession(e){e.destroyed||e.destroy()}}class re extends K{bufferedBytes=[];_write(e,t,n){this.bufferedBytes.push(e),n()}}const ue=r=>se(r)?ie(r):new Promise((e,t)=>{const n=new re;r.pipe(n),r.on("error",s=>{n.end(),t(s)}),n.on("error",t),n.on("finish",function(){const s=new Uint8Array(Buffer.concat(this.bufferedBytes));e(s)})}),se=r=>typeof ReadableStream=="function"&&r instanceof ReadableStream;async function ie(r){const e=[],t=r.getReader();let n=!1,s=0;for(;!n;){const{done:a,value:c}=await t.read();c&&(e.push(c),s+=c.length),n=a}const i=new Uint8Array(s);let o=0;for(const a of e)i.set(a,o),o+=a.length;return i}export{fe as DEFAULT_REQUEST_TIMEOUT,M as NodeHttp2Handler,L as NodeHttpHandler,ue as streamCollector};
|